0

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?

Community
  • 1
  • 1

1 Answers1

1

First of all, you will need to add a method named

public static void main(String[] args)

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.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268