How can I make a java program such that it is always running on the system (such as a daemon or service), but only allow one instance of the program to run? I would like it to start either when I run the program or when the system starts (either is fine).
Asked
Active
Viewed 3,721 times
0
-
You should clarify your question otherwise it is going to be closed. – khachik Dec 14 '10 at 07:30
-
It sounds like you may want it to run as a operating system service. Does it need to be portable, or do you have a specific OS in mind? – Matthew Flaschen Dec 14 '10 at 07:32
-
3Your question horribly formatted: overuse of punctuation marks, no capitalization, using SMS-like abbreviations ("shld" = "should"!). And besides that, it's not clear what you're really trying to do. So, please improve the formatting, and explain yourself more clearly. Thanks. – Bart Kiers Dec 14 '10 at 07:32
-
I rewrote it to what I assumed he was asking, but I might have been wrong so be sure to look at the revision to see if you can scry more from it than I did. – Reese Moore Dec 14 '10 at 07:34
3 Answers
2
Take a look at commons-daemon

Bozho
- 588,226
- 146
- 1,060
- 1,140
-
I found this good to fit many more features including this, please see also: http://stackoverflow.com/questions/979451/auto-startup-for-java-desktop-application/5549910#5549910 – Apr 05 '11 at 09:42
0
I've used this to run a Java program as Windows service service : http://wrapper.tanukisoftware.com/ , with good results.

Daniel Teply
- 1,974
- 1
- 13
- 10