JavaService - User Commands

The basic commands available to users of the JavaService utility are described below. Extended commands are available for more technical users, as described in the developer documentation set. Particular applications that make use of JavaService should provide explicit details that apply to those products.

JavaService Command Format

JavaService is a Windows executable program, which can be invoked from the command line with a range of parameters and options. The order of the command line parameters is fixed by the JavaService program for each command and will lead to unexpected errors if they are not entered in the specified order.

The general format of all commands issued to JavaService is as follows:

JavaService -command

or

JavaService -command -option_1 value_1 -option_2 value_2 -option_3 ...

Where -command indicates the command type required, followed by any command-specific options and values.

NOTE: Any parameters that include spaces (such as many Windows directory names) should be enclosed in quote characters so that they are seen as a single parameter when passed to JavaService (for example "C:\Program Files\MyDirectory");

Also note that if the program is run without any command line parameters, it will not generate any console output as this is the mode used when the service is run in the background.

Main JavaService Commands

The main commands entered by users of the JavaService utility are to install and uninstall a Java application as a Windows service. The utility may also be used to query the status of an installed Java service, or to check the version number of the JavaService software in use. These commands, plus the help facility, are described below.

JavaService Help

For a list of the commands available from JavaService, enter the following command from a Windows prompt:

JavaService -help

For expanded help on any paricular command, enter the following:

JavaService -help command

Service Installation

To install a Java application as a Windows service, you need the following information:

service_name
Service name to be used for the installed application (i.e. MyJavaService)
jvm_location
Java Run-Time Environment location (reference to jvm.dll)
start_class
Java Application program entry point class name (i.e. mypackage.MyClass)
start_method
(optional, default main) Java Application program entry point method name (i.e. startservice)
start_params
(optional, no defaults) Java Application program startup parameters

Given this information, the application can be installed as a service using the following command:

JavaService -install service_name jvm_location -start start_class [-method start_method] [-params start_params]

For example:

JavaService -install MyService C:\J2SDK1.4.2_07\jre\bin\server\jvm.dll -start MyService

There are many more options available for this command, but this is the minimum needed for any Java service installation. The command options required for particular Java applications should ideally be held in a script file for use in Windows, creation of which is to be the responsibility of the relevant application developers or distributors. If you are setting up JavaService for an application yourself, you should refer to the developer documentation for full details of the install options.

Service Removal

To remove a Java application that had previously been installed as a Windows service, use the following command:

JavaService -uninstall service_name

For example:

JavaService -uninstall MyService

This command does not delete any of the application files; it merely removes the service definition and configuration parameters as recorded by JavaService.

JavaService Version Enquiry

To determine the version number of the JavaService software, enter the following command:

JavaService -version

This information is required if investigating or reporting potential problems with the software, and also allows the user to determine if a newer version of the software is available for download.