Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to run a server program in the background on Linux or Windows?

843829Sep 21 2005 — edited Dec 2 2005
I just finished writing a Java network application with multiple clients and one server.
However, I am not sure how I can run the server (SomeServer.class) in the background on Windows. Also when I am running it on Linux, I don't want it to terminate when I logout of the Linux shell.

To run the server on Linux, should I use a command like this?
nohup java -cp . SomeServer.class > output.txt &

Or is there another command, or perhaps some code that I can add to the program so that it would run in the background automatically and/or continues even when I logout of the Linux shell??


Sometimes, I also like to run the program on a Windows XP machine for testing purpose. How can I do it so that it runs in the background without openning a Console/Command Prompt window??
(redirecting the standard output to a file)

And is there an easy way to create a EXE file that runs the program with the default JRE in windows?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 30 2005
Added on Sep 21 2005
2 comments
751 views