I have a block of code, while executing code it will generate popup window, if we click manually then it will process, because of that it is waiting long time, I Would like to introduce timeout function here, can suggest please?
try {
Process process = Runtime.getRuntime();
process.waitFor(); //need to introduce Timeout here.
returnValue = process.exitValue();
if (returnValue != -1) {
return true;
}
} catch (Exception e) {
System.out.println(e);
return false;
if didnt get response within time frame then forget it, and it should return false.