I am using the Runtime class to execute a piece of installation of a software. However, its not working, meaning that, after I fire the job (which is created using the Runtime class), after sometime (which is very soon) the installation job just exits. I think the problem is that the main thread must be finishing up and thus killing the Process that is created using the Runtime class. Am I correct ? And what is the solution here ?
this is how I fire my job inside teh main class :
try
{
Runtime.getRuntime().exec(cmd);
}
catch(IOException e)
{
//add logging functionality
e.printStackTrace();
}
Soon after this command, the main function finishes.
There is no problem with the Runtime command. It works .. I can even see it starting(the installation taht I am firing thru the code) and then it suddenly exits.
You might want to check out the java.lang.Process class. You probably want something like this:
The subprocess may be receiving a SIGHUP and exiting.
EDIT:
In context, something like this, I would think: