There is no direct method available that can provide you the state of the process if you use use the waitFor
then your current thread will wait until the process terminates.
So you can use exitValue
function wrapped in function something like this,
public static boolean isProcessRunning(Process process)
{
try
{
process.exitValue();
return false;
}
catch(IllegalThreadStateException e)
{
return true;
}
}
And then you can continue doing other work and call above method to check the state as and when needed.