JBoss As Service

It can be handy to have JBoss running as a Windows service. The JBoss site wiki talks about a couple of ways to do it.

One method is to use a piece of software from the Tanuki Software group called the Java Service Wrapper. Simply download the Java Service Wrapper binaries and choose one of the following methods to integrate your Java application with the Service Wrapper. The Java Service Wrapper makes it easy to install any java application as a Windows NT Service or a UNIX daemon. I chose Method 1 as it is the simplest. This method uses a WrapperSimpleApp helper class to launch your application. Detailed instructions are available here Tanuki installation instructions. The following is a summary of the important steps.

Key Steps to Installing JBoss as a Windows Service Using Java Service Wrapper

Important Installation Notes:

  • where the Tanuki instructions say to put things under %JBOSS_HOME%/lib, instead put them under %JBOSS_HOME%/server/default/lib
  • the Java Wrapper Service uses a configuration file named wrapper.conf. To make this file portable from machine to machine, it is advisable to use environment variables. On Windows XP, make sure you have %JAVA_HOME% and %JBOSS_HOME% set up as System Variable and not User Variables.

Installing Wrapper Files

After downloading the binaries, copy the following files into the %JBOSS_HOME%/bin directory:


Make sure to rename the batch files as follows:


Also copy the following files into the %JBOSS_HOME%/server/default/lib directory


Installing the wrapper.conf File

The Wrapper Service requires a configuration file. Copy the file from
{WRAPPER_HOME}srcconfwrapper.conf.in into {JBOSS_HOME}conf. This directory might not exist so please create it. Before the wrapper can actually launch your service you will need to edit the wrapper.conf file to build up the java command used to launch the application. To inspect this command you can use a neat little trick. JBoss is launched using the run.bat file that exists in %JBOSS_HOME%/lib. Open up this file and look for a line similar to the following:

“%JAVA%” %JAVA_OPTS% “-Djava.endorsed.dirs=%JBOSS_ENDORSED_DIRS%” -classpath “%JBOSS_CLASSPATH%” org.jboss.Main

Simply add the word ECHO in front of this line and launch JBoss by typing run at the command line (make sure you are in %JBOSS_HOME%bin).

You should get a screen like the following which actually echos out the java command used to launch JBoss.

You should then edit the wrapper.conf to build up the java command by filling in values for the appropriate properties. These values are from your java command that you echoed. The minimum variables that you will need to edit are:

  • wrapper.java.command
  • wrapper.java.additional
  • wrapper.java.classpath
  • wrapper.java.mainclass
  • wrapper.app-parameter
  • wrapper.java-library-path

Actual documentation on these properties can be found here

Full details on setting each of these properties is also available in the instructions linked to earlier. As an example, in order to tell our Java Service Wrapper where the java command lives we could set the following property in the wrapper.conf file:

wrapper.java.command=C:/Program Files/Java/jdk1.5.0_06/bin/java

Notice that I pulled the value for this property from the above screenshot. Doing this limits our setup for only a particular machine so it is better to do this:


The following shows all the properties I ended up setting in my wrapper.conf file:


Installing JBoss as a Service

Now that you have integrated the Java Wrapper Service with JBoss, you are ready to launch JBoss as a service. To do this use the following command
from the location of wrapper.exe and run

wrapper.exe -i ../conf/wrapper.conf

…and voila, JBoss should now be available as a service!

Uninstalling JBoss as a Service

If you ever need to uninstall JBoss as a service, execute the following command from the location of wrapper.exe.

wrapper.exe -r ../conf/wrapper.conf

It's only fair to share...
Share on Facebook
Tweet about this on Twitter
Share on LinkedIn

Leave a Reply