I downloaded SymmetricDS, a tool for Database replication and tried to run it on my Windows7 machine. The program can be launched from command line and it works with Windows Terminal. However I always prefer Git Bash
for command line stuff. When I run command sym
though, I got error:
Error: Could not find or load main class org.jumpmind.symmetric.SymmetricLauncher
This tool is written in Java. I have JDK 1.8 installed. Git Bash inherits all environmental variables including $PATH
and $JAVA_HOME
from Windows. But why is it complaining about not finding the class?
The sym
command is really running the following command:
exec "$SYM_JAVA" $SYM_OPTIONS -cp "$CLASSPATH" org.jumpmind.symmetric.SymmetricLauncher "$@"
All the jars are located in lib
under the root directory of the application. The classpath is defined in a sym.service.conf
inside conf
directory:
# Java Classpath
wrapper.java.classpath.1=patches
wrapper.java.classpath.2=patches/*
wrapper.java.classpath.3=lib/*.jar
wrapper.java.classpath.4=web/WEB-INF/lib/*.jar
# Application main class and arguments
wrapper.app.parameter.1=org.jumpmind.symmetric.SymmetricLauncher
I added echo $CLASSPATH
right before the exec
to print out the class path and it did seem to get all of them right:
/c/Users/dnj0109/Apps/symmetric-server-3.8.29/patches:
/c/Users/dnj0109/Apps/symmetric-server-3.8.29/patches/*:
/c/Users/dnj0109/Apps/symmetric-server-3.8.29/lib/*:
/c/Users/dnj0109/Apps/symmetric-server-3.8.29/web/WEB-INF/lib/*
That could be related to this thread:
On Windows, the path separator is a semicolon ('
;
' instead of ':
').
Don't ask why. Traditionally, the semicolon is interpreted by the Bash as the command separator, so you'll have to escape it:
$ java -cp lib/clojure-1.1.0.jar\;lib/clojure-contrib-1.1.0.jar
If you wonder why it works with PATH: MSys has special handling routines for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With