Link to home
Start Free TrialLog in
Avatar of sangeet24
sangeet24

asked on

adding java class file as NT Service



How can I add a java class file as NT Service so that it will start automatically when the system is restarted.Thanx in advance.

Sasikumar Rohithasha.

Avatar of offerm
offerm

Use Invoker.exe to register your program as a windows NT service.

http://www.idetix.com/support_files.htm

Invoker is a free administrative and development command line utility for Microsoft Windows NT 3.51/4.0 (Intel) that creates a registered service out of (most) applications that can be launched by the command line.

Avatar of sangeet24

ASKER

I need others comments also in this.Your answer is good but i want to unlock the question.
I need others comments also in this.Your answer is good but i want to unlock the question.
I need others comments also in this.Your answer is good but i want to unlock the question.
ASKER CERTIFIED SOLUTION
Avatar of venkat2000120699
venkat2000120699

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jim Cakalic
Which solution is applicable to your problem depends in part on your specific requirements.

Do you need for your java application to participate in Service Control Manager (SCM) stop requests. Many of the solutions, like ServiceRunner mentioned above and Microsoft's srvany utility, do not provide for this. We needed our services to shutdown gracefully and so could not choose these solutions.

After evaluating several available packages, we came across JavaService from Alexandria Software. This is a free, open-source, native NT executable that provides for registration specifically of Java applications as NT services. It is not a "run anything" invoker. It is intended for Java applications. As such, it provides command line options used at registration to specify such things as current directory, redirection of System.err and System.out to files, additional directories to be appended to the system PATH, and specification of JVM options. This flexibility was critical to us. In addition, JavaService permits specification of both a start class (the one containing main or a similarly declared start method) and a stop class and method to be called when the SCM requests service stop. This permits (but does not require) that your Java application participate in a graceful shutdown. It is also useful that the application can be renamed so that it will have a unique name in Task Manager -- important should you need to run multiple services on the same system. It also logs info and error messages to the NT Event Log.

As an endorsememt, I must state that my team has had great success with the package. We had test services installed in literally minutes because of the ease of use and flexibility it offers. It is the only product we have found to date which allows us to run WebSphere EJB client Java applications as NT services.

The package and related documentation can be retrieved from:
    http://www.alexandriasc.com/software/JavaService/index.html

Best regards,
Jim Cakalic
I'm using JavaService which you can get from
http://www.alexandriasc.com/software/JavaService/download.html
You can also download the source so you can make modifications if needed.
I had to enhance it for running TomCat as a servi. The CLASSPATH got too
long for it.