Java Tutorial - Java Scipt :
Installing JBoss in Windows
Perhaps the most common Windows question in using Java on the server side is, “How can I get my Java application to run as a service?” A service in Windows (similar to a daemon in Linux) executes a program independently of the user login and allows it to automatically start when the computer starts. The service will constantly be running in the background, allowing JBoss to be available at all times. In addition, a service can be configured by a system administrator to give it specific access privileges, permissions, and resources. This is crucial for a production deployment of JBoss and something that must be addressed for any server-type application, such as the servlet containers and databases. In the early days, there were some products that wrapped themselves inside of a Java application to allow themselves to run as a service. They worked for the most part but had some minor annoyances. Happily, the situation is much improved. The best product to date is Java Service by Alexandria Software Consulting, which is a free open source program that installs any Java program as an NT Service. The process is simple, and there is ample documentation available on their site to help you customize your configuration. The
following table gives a summary of Java Service.
The exact script will depend a lot on your settings, but on our machine the script looks like this:
JavaService.exe -install JBoss %JAVA_HOME%\jre\bin\server\jvm.dll -
Djava.class.path=%JAVA_HOME%\lib\tools.jar;%JBOSS_HOME%\bin\run.jar -
start org.jboss.Main -stop org.jboss.Main -method systemExit -current
%JBOSS_HOME%\bin
Be sure that your JAVA_HOME and JBOSS_HOME environment variables are properly set.
This script installs JBoss as a service under the name JBoss. If you open up the Services administration panel, located under Control Panel ➪Administrative Tools, you’ll see your newly installed service as shown in Figure 10
To uninstall this program, just run JavaService.exe –uninstall JBoss.
The Services administration panel makes it easy for you to start and stop services. Other management tasks can be performed here as well. The two most important tasks are setting the startup type and setting the account associated with the service. In most cases, you will want to change the startup type from its default setting to Automatic. To change the account associated with the JBoss service, check under the “Log On As” column: this shows the account associated with the JBoss service. Depending on your security configuration, you may want to change the account to a user account specifically created for JBoss. This way, you can manage permissions in a more fine-grained manner. By default, JBoss is associated with the Local System account. We will leave it alone because this account is normally used by Windows for server services such as IIS. The following table gives a summary of the JBoss service.