简体   繁体   中英

Dependent class can't be found when invoke by java -classpath xxx -jar jarfile, but can be found by java -classpath xx class

Case 1:

java  -cp LRS3rdPartyClient.jar -jar tasks.jar 

Case 2:

java -classpath LRS3rdPartyClient.jar;tasks.jar com.lombardrisk.build.WaitForServerStart

Case 1 does not execute, because a class, which resides in LRS3rdPartyClient.jar cannot be found, whereas the Case 2 executes properly.

I'am quite confused.

When using -jar , the classpath is ignored . Only the classpath specified in the jar file's manifest is used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM