This seemingly simple problem is stumping me. I have a jar with a set of dependencies which I cannot seem to get working in linux. All jars and the script reside in the same directory.
This one picks up and tries to run my main class
java -cp MyJar.jar com.mylib.MyMainClass
java -cp MyJar.jar:MyDependencyJar.jar com.mylib.MyMainClass
java -cp . com.mylib.MyMainClass
java -cp *.jar com.mylib.MyMainClass
java -cp .:*.jar com.mylib.MyMainClass
Try this one:
java -cp /path/to/jar1.jar:/path/to/jar2.jar:. com.mylib.MyMainClass
Note that you should not omit that final
. in the classpath, which represent the current working directory, because using
-cp would override your previous classpath setting.