linux - unix java classpath cp adding -


this seemingly simple problem stumping me. have jar set of dependencies cannot seem working in linux. jars , script reside in same directory.

this 1 picks , tries run main class

java -cp myjar.jar com.mylib.mymainclass 

but of course throws classnotfoundexception on 1 of dependency classes. try add 1 of dependencies so

java -cp myjar.jar:mydependencyjar.jar com.mylib.mymainclass 

then says classnotfoundexception com.mylib.mymainclass !

i tried these various same problems

java -cp . com.mylib.mymainclass 

and this

java -cp *.jar com.mylib.mymainclass 

and this

java -cp .:*.jar com.mylib.mymainclass 

any idea please ?

try one:

java -cp /path/to/jar1.jar:/path/to/jar2.jar:. com.mylib.mymainclass 

note should not omit final . in classpath, represent current working directory, because using -cp override previous classpath setting.


Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -