Search code examples
javajvmjvm-arguments

Run Java console app as a daemon (background)


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 ?


Solution

  • 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>