SourceForge.net Logo

Java Service Launcher (for Windows) JSL 0.99q - January 2017

Download here or contact the author at  Michael@Roeschter.com

FAQ

Off course there is still a lot that may go wrong.

My Java program doesnt start.
Run JSL in debug from command line using jsl -debug. Create some debug output in your Java program. Only if things are fine in debug mode install it as a service.
One common issues is mounted network drives, which are not visible from a service. Use UNC path instead (//server/path).

The JSL won't start JRockit
Set the jvmtype parameter in the jsl.ini file to jrockit. JRockit uses a strange naming convention for the JVM location. It's located in jre\bin\jrockit\jvm.dll.
Another approach is to move the jrockit folder to jre\bin\classic\jvm.dll and it will work nicely.

The JSL fails to start saying the a DLL is missing.
When running the plain jsl.exe, which is a bit smaller and dynamically linked you will need a few Microsfot Visual C libraries, which most likely are already on your system. If you see problems, try the statically linked executable which has no such dependencies.

When do I need 32bit and 64bit versions?
You need a 64bit OS to run 64bit JSL, but you can also run the 32bit version on a 64bit OS. The 64bit JSL starts the 64bit JVM and the 32bit JSl run the 32bit JVM.

Which Java Runtime Environment is used when I start the jsl?
JSL attempts to find the JRE in the following location in the order given. For details look into java_md.c,

  1. It reads the jrepath parameter from the configuration file
  2. It loks for a java.dll in the bin directoy colocated with the jsl.exe
  3. It loks for a java.dll in the jre\bin directoy colocated with the jsl.exe
  4. It looks for JRE path in the registry

How can I make sure the JAVA application is restarted after it fails
JSL doesn't care about this, but Windows (Server) comes with tools to monitor and automatically restart service. Those tools will usually rely on the service return code to decide if the shutdown was normal or abnormal. JSL has a number of settings to pass the the java exit code or to react to exception in appropriate ways.
See 'exceptionerrorcode' and 'onexiterror' settings in the configuration file.

The program did run fine in debug mode but can't find files when run as a service
Don't rely on the standard path when locating files from the service. Always use absolute paths. The service will find it's start path through a java system property. You can use environment substitutions now but be careful and make your first tries without them.

How can I find out from which directory the service was started and how it is named
The JVM is started with a command line similar to this one.

java -Dservice.stop.port=8465
-Dservice.path=E:\Java\TEST\jsl_0_9\Debug\

-Dservice.name=TelnetEcho -cp e:\java\test\jsl_0_9 TelnetEcho
The -D options can be accessed through the System Properties. Look in class java.lang.System for details.

The program did run fine in debug mode but still does not find the files it needs though I load them from an absolute path.
Drives mounted from a network device are not accessible from a service!
Access them through fully qualified network names.

\\myserver\myfiles\myservice\hello.data

The program did run fine in debug mode but is denied access to the network shares I need
In standard settings the service will run as a system user. Sytem user can't access the network. You need to change the security settings manually in the NT service manager.
There may be other more exotic errors which could result from this.

The service runs fine but I can't stop it. Service manager tells me the stop request failed and I can't stop it using the task manager.
Services can not be stopped forcedly (except with a debugger). They must stop themselves. That's what the JNI calls into the running JVM are for. You may also use the stopable interface. Please see the HowTo guide.
To get rid of your service you must either restart NT (after you set service starting mode to manual) or use a C debugger to attach to and kill the service.