World Map
Java Service Wrapper is the easiest way to make your product more reliable.
  • Free Trial
  • Buy Now
Paths in Configuration Properties

Paths in Configuration Properties

Java handles both forward slashes '/', and backslashes '\', correctly on Windows. To make your Java Service Wrapper Configuration file "wrapper.conf" cross platform compatible, you should always use forward slashes in all paths in "wrapper.conf".

At startup of Java Service Wrapper, it always sets its current working directory to the location of the Wrapper executable. When the Wrapper launches Java, its working directory will remain the same, making relative path references function reliably.

On Linux and UNIX versions, the shell script (sh) which is shipped with the Wrapper will change the working directory to the location of the script. This is required so that relative paths will always work correctly even when the script used to launch the Wrapper is referenced using a symbolic reference.

Recommend relative paths:

The above functionality on all platforms makes it possible to make all file references in the configuration file use relative paths. Relative paths are preferable in most cases because they make it easy to install an application at any location and then it work correctly without modification. In most cases relative file references will also work on all platforms.

Change absolute paths to relative paths:

The example configuration file fragments below show that some property values which use static platform, specifically with absolute paths can be modified to relative paths. Note that there is no static platform specified in the second example of the properties. This example assumes that the Wrapper binaries and scripts are located in a bin directory under the application's home directory. The application also contains its own JRE to make the installation easier for users.

Properties with absolute path (not recommended):
wrapper.java.command=C:/MyApp/jre/bin/java
wrapper.java.classpath.1=C:/MyApp/lib/wrapper.jar
wrapper.java.library.path.1=C:/MyApp/lib
wrapper.logfile=C:/MyApp/logs/wrapper.log
Properties with relative path (recommended):
wrapper.java.command=../jre/bin/java
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.library.path.1=../lib
wrapper.logfile=../logs/wrapper.log