Run Java console app as a daemon (background)

aleroot picture aleroot · Jun 24, 2011 · Viewed 22.2k times · Source

I've developed a Java console application that when start, open a console window and remain in foreground, i want to start that application in background .

Now i launch the application by this command line :

java -jar myapp.jar

Is there a way to achieve this behaviour ? It's enough change the command line parameter or i need to do some change on my code ?

Answer

Steve Brisk picture Steve Brisk · Jun 24, 2011

The answer is operating system dependent.

*nix: <your command> &
Windows: (opens a new console): start <your command>
Windows: (doesn't open a new console): start /b <your command>