How to run JBoss AS as a Windows Service
JBoss AS comes with Windows service executable as part of JBossNative library that can run JBoss Application Server as service.
The service executable jbosssvc.exe transforms the run.bat and shutdown.bat batch scripts to services. This means that any change made to those scripts will be used both in service and commandline mode.
Install:
To install the JBoss Application Server as Windows service use the provided service.bat batch file.
C:> cd c:jboss-6.0.0bin
C: jboss-6.0.0bin > service.bat install
Start:
To start the JBoss Application Server as Windows service user Control panel or net start command. When running in service mode the console output is redirected to the file run.log. You can inspect the file for any errors during service startup.
C: jboss-6.0.0bin> service.bat start
or
C: jboss-6.0.0bin > net start JBAS60SVC
The JBoss Application Server 6.0 service is starting.
The JBoss Application Server 6.0 service was started successfully.
Stop:
To stop the JBoss Application Server as Windows service use Control panel or net stop command. When running in service mode the console output is redirected to the file shutdown.log. You can inspect the file for any errors during service shutdown.
C: jboss-6.0.0bin> service.bat stop
or
C:> net stop JBAS60SVC
The JBoss Application Server 6.0 service was stopped successfully.
To restart the JBoss Application Server as Windows service use Control pannel.
Uninstall:
To remove the JBoss Application Server as Windows service use the provided
service.bat batch file.
C:> cd c:jboss-6.0.0bin
C: jboss-6.0.0bin > service.bat uninstall
Service customization is done by editing the service.bat script. Each command has a separate section that you can customize. The most common customization task would be changing service names if more then one service instances per box are required.
You can find some of the below entries in the service.bat file that we can manipulate accordingly.
set SVCNAME=JBAS50SVC set SVCDISP=JBoss Application Server 5.1 set SVCDESC=JBoss Application Server 5.1.0 GA/Platform: Windows x86 set NOPAUSE=Y REM Suppress killing service on logoff event set JAVA_OPTS=-Xrs
Best Regards.
Note that you must launch the command shell with admin rights: right-click on target -> “Run as Admin…” (shield icon)…