Examples For an example of a simple
java service see the files:
- jsl.ini
- src/java/com/roeschter/jsl/TelnetEcho.java
Adjust the classpath in the jsl.ini (at the very end)
and run jsl.exe (no parameters) from command line.
The out put shoud look like this
JSL Java Service Launcher by Michael Roeschter
(Michael@Roeschter.com)
JSL 0.99q - January 2017
Command line options:
jsl -install [ini] to install the service
jsl -configure [ini] to reconfigure an installed service
with new dependencies
jsl -remove [ini] to remove the service
jsl -debug [ini] to run as a console app for debugging
jsl -run [ini] to run as a standalone console app
Initalization file: C:\Java\TEST\jsl_0_9_9c\Release\jsl.ini
jrepath=
dependencies=
dependency=
starttype=auto
account=(null)
password=(null)
loadordergroup=someorder
wrkdir=
appname=Telnet Echo
servicename=TelnetEcho
displayname=Telnet Echo
stdout=
stderr=
systemout=
systemerr=
systemoutappend=no
systemerrappend=no
exceptionerrorcode=0
onexiterror=ignore
stopclass=java/lang/System
stopmethod=exit
stopsignature=(I)V
pauseclass=
pausemethod=
pausesignature=
contclass=
contmethod=
contsignature=
stopport=0
startdelay=0
useconsolehandler=yes
path=
modulepath=
param00=-cp
param01=c:\java\test\jsl_0_9_9c\src
param02=com.roeschter.jsl.TelnetEcho
Java command line:
java -Dservice.stop.port=0
-Dservice.path=C:\Java\TEST\jsl_0_9_9c\Release\
-Dservice.name=TelnetEcho -cp c:\java\test\jsl_0_9_9c\src
com.roeschter.jsl.TelnetEcho
StartServiceCtrlDispatcher being called.
This may take several seconds. Please wait.
Now adjust the classpath setting in the
initialization file.
Run jsl.exe -debug after you unpacked the distribution
package.
Telnet echo will run a primitive telnet server which
will simple echo back any character you try.
Test ist by running your favorite telnet terminal
against your localhost.
Now install the service with jsl -install.
Go to the NT service manager and start it up.
Test again and try to shut it down in the service
manager.
Uninstall with jsl -remove.
Now nothing should go wrong with your own
service. |