简体   繁体   中英

Calling class of a jar inside the lib folder of a jar from command line?

I am making a maven project which contains a dependency with runtime scope. I want to call this jar class directly from command line. I don't have the option to make fat jar. My Jar structure is:-

one.jar
--- temp.class
.....
.....
/lib/two.jar
/lib/three.jar

suppose I want to call Temp1 class of two.jar directly from the command line.

java -cp "path" "classname"

eg : java -cp C:\\one.jar com.test.main.temp

OR

java -cp /usr/local/jar/one.jar:/some/other/two.jar com.your.main.classname

您可以在one.jar中放置一个“代理”类,该类委托给嵌入式two.jar中的目标类

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