As an alternative to using the scripts provided with the Java Service
Wrapper. You may choose to launch the Wrapper directly. If the
Wrapper.exe executable is launched
without any parameters, the following usage output will be displayed.
C:\MyApp\bin>Wrapper.exe
Usage:
Wrapper.exe <command> <configuration file> [configuration properties] [...]
where <command> can be one of:
-c run as a Console application
-t starT an NT service
-p stoP a running NT service
-i Install as an NT service
-r Remove as an NT service
-? print this help message
<configuration file> is the wrapper.conf to use
[configuration properties] are configuration name-value pairs which override values
in wrapper.conf. For example:
wrapper.debug=true
|
To run the Java Service Wrapper as a console application, you would
specify the -c command, followed
by the wrapper.conf file. The location of the
wrapper.conf file can be an
absolute or relative location. If a relative path is used, the path
is always relative to the location of the
Wrapper.exe file, not the current
directory.
C:\MyApp\bin>Wrapper.exe -c ..\conf\wrapper.conf
|
To install the application as an NT service, execute:
C:\MyApp\bin>Wrapper.exe -i ..\conf\wrapper.conf
|
Once installed, the service can be started just like any other NT
service. If the wrapper.ntservice.starttype
was set to AUTO_START when
installed, then the service will be started the next time the
machine is rebooted. It is also possible to start the service
manually from the services control panel, or by executing either
of the following two commands:
C:\MyApp\bin>net start MyApp
C:\MyApp\bin>Wrapper.exe -t ..\conf\wrapper.conf
|
NOTE
|  |
The net start x and
net stop x commands have problems
with services that take a long time to start or stop. In most
cases they will work, but if a service takes more than a few seconds
to stop, the net stop x command
will return that the service was stopped even though it is still in
the process of stopping. This can lead to problems when a script
must wait until a service has actually stopped before proceeding.
By using the Wrapper to start and stop the service, you will be
guaranteed not to have any such problems.
The Wrapper method of starting and stopping the service is also
useful in scripts as it does not require the actual name that
the service is installed as to exist anywhere except in the
wrapper.conf file. This
removes the need for manual editing of multiple files if the
service name is changed.
|
The service can be stopped using the services control panel, or by
executing either of the following commands:
C:\MyApp\bin>net stop MyApp
C:\MyApp\bin>Wrapper.exe -p ..\conf\wrapper.conf
|
To uninstall the application as an NT service, execute:
C:\MyApp\bin>Wrapper.exe -r ..\conf\wrapper.conf
|
If the service is running at the time that it is uninstalled, the service
will be cleanly stopped and then removed.
|