adding java class file as NT Service

Posted on 2001-06-11
Medium Priority
Last Modified: 2010-04-16

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.

Question by:sangeet24

Expert Comment

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


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.


Author Comment

ID: 6177953
I need others comments also in this.Your answer is good but i want to unlock the question.

Author Comment

ID: 6177956
I need others comments also in this.Your answer is good but i want to unlock the question.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.


Author Comment

ID: 6177959
I need others comments also in this.Your answer is good but i want to unlock the question.

Accepted Solution

venkat2000120699 earned 400 total points
ID: 6178026
Go to the page: http://www.javaworld.com/javaworld/tools/jw-tools-util.html

and search for ServiceRunner on that page.  U can download a utility which runs any Java application as a service on Windows NT.
LVL 19

Expert Comment

by:Jim Cakalic
ID: 6178089
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:

Best regards,
Jim Cakalic

Expert Comment

ID: 6178429
I'm using JavaService which you can get from
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.

Expert Comment

ID: 6180337

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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 about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

587 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