Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"Daemonizing" a Java program

Posted on 1998-08-17
3
Medium Priority
?
263 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 280 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

604 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