Possible Duplicate:
Java – C-Like Fork?
I have a static void main with this:
ScreenStarter.main(clients.get(i).getSocket(), clientips.get(i));
In ScreenStarter, I have another static void main Where I call following:
public static void main(Socket sock, String ip) throws IOException{
new ClientConn(sock, ip).start();
}
Is it possible to start ScreenStarter as a seperate process?
First of all, you will need to add a method named
which can call your current ScreenStarter.main(). Then use one of the
exec()methods from java.lang.Runtime. Alternatively, you can use java.lang.ProcessBuilder to spawn the second process. See this article for a tutorial describing the differences between the two.