I am trying to launch multiple links using java, but firefox
is giving an error
Firefox is already running please close first
So to avoid this, I added a delay between launching links. but this delay is blocking my main program. I made this piece of code as thread so that main program does not block, But exiting main program causes this thread to terminate without sleeping. This is my piece of code
main{
runCommand run= new runCommand();
run.start();
}
private class runCommand extends Thread{
@Override
public void run() {
LaunchProcess("xdg-open https://www.google.com")
Thread.sleep(8000);
LaunchProcess("xdg-open https:www.gmail.com")
}
LaunchProcess
is a function that uses runtime.getExec
to exec command. the above code launches only the first link and exits as the main program exits. How to make sure that exiting main program does not terminate the threads launched by it. I dont want to add sleep in main program