9

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/*
0

2 Answers 2

16

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.

Sign up to request clarification or add additional context in comments.

Comments

2

Another reason that a java app may run in a Windows CMD shell but not in a Windows git bash shell is that the classpath used to run the app contains one of the following:

  • relative paths (e.g. ../foo)
  • network drives (e.g. //servername/bah

See: https://github.com/git-for-windows/git/issues/1028

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.