Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

"Daemonizing" a Java program

Posted on 1998-08-17
Last Modified: 2012-06-22
Is it possible to detach a Java program from its terminal, eg the MSDOS prompt for Win95, or the xterm for Lynix??? I have been banging my head against the wall for quite a while on this. Some process similar to giving a thread daemon status on Unix-based machines. Instantiating a new class inside a thread with setDaemon(true) and then exiting does not work! Any other ideas/options.

Question by:jdyer
  • 2

Accepted Solution

evijay earned 70 total points
ID: 1222008
Use javaw instead of java to run the program.

say you have a test daemon Test.class

run it using

javaw Test

If you want a daemon to start when the user logs in

in nt, you put command javaw classname in the startup panel.
in unix, add this in initialization file.


Expert Comment

ID: 1222009
you can close the input and output streams,



This detaches java program from terminal.


Author Comment

ID: 1222010
Thx so much, I had never noticed that or used that program in 1-1/2 years of Java programming. Time to look over the docs again I guess.

Thanx for waking me up!
 - jdyer


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
print map entry 34 72
java stored proc example 9 44
SHA2 certs for IIS AND Java? 2 113
Can anyone please tell me why i can not find ID  investorCoolGrid inside the jsp page? 1 22
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question