Using Wrapper To Run Your Application Into A Service

Last time, my friend asked me to do some research for changing our existing java application from a bat file into a windows service. He already try to done that, but the service always returning message something like “failed to start”.
So this is my quick tips to after i research for a while.

First of all, please download this library, and extract it.

What you have to know first is what kind of type your application need.

Wrapper lib separated service types into :
1. WrapperSimpleApp
2. WrapperStartStopApp
3. WrapperListener
4. WrapperJarApp

For further information about those types, you can read here

Let say your application services type belong to ‘WrapperSimpleApp’.

Now open the configuration file with your preferred editor which is located under ‘conf’ folder.

What you have to do is change this properties :

1
wrapper.java.mainclass = org.tanukisoftware.wrapper.<one of your service type>

At this point you will tell the wrapper what is your application service type that you want to use.

1
2
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../<folder-name>/<your-application>.jar

At this point you need to inform the wrapper what and where are the library needed by the application. you can add another useful library for your application at there.

Now let tell the wrapper what is your main class

1
wrapper.app.parameter.1=<package-name.your-application-main-class>

Named your console application, service name and also service description. Trust me it will make easier for you when you search your service at your OS service list

1
2
wrapper.console.title=<console-application-name>
wrapper.name=<service-name>

Another thing that you should need to consider, is there any service dependency at your application?
I was created the printer server application, client could send message to the server and print it by sending some message into my application. so in this case, i should include.

1
wrapper.ntservice.dependency.1=Spooler

Now go to your wrapper/bin directory and run ‘InstallTestWrapper-NT.bat’
After it Installed successfully, run ‘StartTestWrapper-NT.bat’.

Now your application already running as an operating system service, Enjoy..

Incoming search terms:

  • java service wrapper tutorial (103)
  • java service wrapper tutorial windows (1)
  • tutorial java service wrapper (1)
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Tagged , , , . Bookmark the permalink.

2 Responses to Using Wrapper To Run Your Application Into A Service

  1. woi… update nyong…! gw byk trick adsense nih… mau brainstorming ga :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>