Running a Java app as a service

J

James Longred

Hi,

I've normally written fairly straight forward Java Swing applications. Now
I'm going to be trying to write an app that needs to run as a service under
NT and/or Linux. A googling suggests this is quite feasible but with some
challenges relating to how to start it properly, getting notified of shut
downs or restart requests, etc. Unfortunately much seems to be quite out of
date or very NT specific.

Can anyone recommend a good place for me to start reading on the topic or
perhaps some skeleton code to examine?

Thanks all.
 
H

Hugo Pragt

You can make it a .exe file and any .exe can be installed as a service via
srvany (windows powerpack)

Hugo
 
B

Bjorn Abelli

...
You can make it a .exe file and any .exe can be
installed as a service via
srvany (windows powerpack)

There's no need of "making it" an exe, since the JVM is an executable
anyway. Just use srvany directly on java.exe with the right arguments.

However, some caution has to be made as the NT-service can be "interuppted"
by a user logoff on NT with Java version 1.3. I believe it has been fixed in
1.4, but to be on the safe side you could use a wrapper for this purpose.
There are several freely available. One example:

http://www.alexandriasc.com/software/JavaService/index.html

AFAIK this problem doesn't occur on Linux, where you can start any
background process you like with a simple script at startup (or so I'm
told).


HTH
Bjorn A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,771
Messages
2,569,587
Members
45,097
Latest member
RayE496148
Top