Running Servers as Windows Services

In NavisRadius, new Windows NT Service executables are added to support the JavaTM 2 Platform. The executables are:

These executables are installed into the bin directory, and are linked with jvm.dll. They will not work with Java 1.1. The names of the services are the same and the services for Java 1.1 and services for Java 2 cannot be installed at the same time. To change from one version to the other requires removing one version and installing the other.

Each executable accepts the following arguments:

Parameter Description
-i or -install Installs the service executable with the Windows NT Service Control Manager (SCM).
-r or -remove Removes the service executable with the SCM.
-d Runs the service executable outside of the SCM for debugging purposes.
-start Starts the service if installed under the SCM and is currently stopped. Returns a non-zero exit status if unable to start the service or the service is already running. A text message is also written to standard out describing the outcome of the request.
-stop Stops the service if installed under the SCM and is currently started. Returns a non-zero exit status if unable to stop the service or the service is not active. A text message is also written to standard out describing the outcome of the request.
-query Asks the SCM for the status of the service. If the service is not installed or encounters an error querying the server, a non-zero exit status will be returned and a message describing the error will be written to standard output. If the service is found, a non-zero exit status will be returned and one of the following strings to standard out:

Exit Code Message to Standard Out
1 STOPPED
2 START_PENDING
3 STOP_PENDING
4 RUNNING
5 CONTINUE_PENDING
6 PAUSE_PENDING
7 PAUSED
? UNKNOWN

Service Registry Keys

Each service depends on information contained in the Windows registry under the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Lucent\NavisRadius\3.2\

There are three keys named RadiusService, StateService and GuiService. Each of these keys has values set to tell the service how and where to start the Java Virtual Machine (JVM). Currently up to 10 JVM options can be set. The name of each value must start with "JavaVMOption" and end with a digit 0 through 9. The RunDir value specifies the directory the service should change to before starting the JVM. The JVM options should include classpath information. These options are not used by the NavisRadius Windows Services for Java 1.1 and the classpath and other specific options used by the Java 1.1 services are ignore by the Java 2.0 services.

Following is an example of the some options set for the RadiusService for a development system:

[HKEY_LOCAL_MACHINE\SOFTWARE\Lucent\NavisRadius\3.2\RadiusService]
"RunDir"="d:\\nr\\config\\run-test"
"JavaVMOption1"="-Djava.class.path=D:\\nr"
"JavaVMOption2"="-Djava.library.path=D:\\nr\\config\\lib"
"JavaVMOption3"="-Xmx50m"
"JavaVMOption0"="-Djava.ext.dirs=D:\\nr\\config\\lib"
"JavaVMOption4"="-verbose:gc,class,jni"

If the -verbose option is set—it should only be set for debugging purposes—the output is sent to the directory specified by the RunDir path as a file called "vm.out".

Note: The Windows NT system path must include the directory containing the jvm.dll. This directory is located in the classic subdirectory of the jre directory. Failure to set the system path will cause the services to fail with an "Unable To Locate DLL" error message.