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

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -