http://javaservice.objectweb.org/
Example (JBoss 3.0)
The JBoss server software provides a Java run-time environment that can be used for JSP and J2EE applications. In this use, it often needs to be run as a Windows NT System Service, for which the JavaService utility is designed. Depending on configuration, JBoss may require that an associated database server is already running, which should be set up as a Windows NT Service dependency, with the example below set up against the MySql database. {JDK_HOME} is the location of your JDK and {JBOSS_BIN} is the location of your JBoss binaries installation. These instructions are based on information in the JBoss 3.0 quick-start guide, but are in any case provided 'as is'.
- Copy the JavaService.exe file into the {JBOSS_BIN} directory as JBossService.exe.
- Start a command prompt and change to the directory {JBOSS_BIN}.
- Run the following command:
JBossService.exe -install JBoss
{JDK_HOME}\jre\bin\{hotspot|server|classic}\jvm.dll
-Djava.class.path={JDK_HOME}\lib\tools.jar;{JBOSS_BIN}\run.jar
-start org.jboss.Main
-stop org.jboss.Main -method systemExit
-out {JBOSS_BIN}\stdout.log
-err {JBOSS_BIN}\stderr.log
-current {JBOSS_BIN}
-depends mysql
-manual
-overwrite
-startup 10
- To remove the registered service, run the following command from the same directory:
JBossService.exe -uninstall JBoss
The JBoss service can then be started by issuing the following command, which will also start the MySql service beforehand if it is not already running:
net start jboss
The service can then be stopped by issuing the following command:
net stop jboss