Solved

"Daemonizing" a Java program

Posted on 1998-08-17
3
252 Views
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.

Thx,
  jdyer
0
Comment
Question by:jdyer
[X]
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
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
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.


0
 
LVL 4

Expert Comment

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

System.in.close();

System.out.close();
System.err.close();

This detaches java program from terminal.


0
 
LVL 1

Author Comment

by:jdyer
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

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

733 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