简体   繁体   English

从命令行调用jar的lib文件夹内的jar的类?

[英]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. 我正在制作一个包含运行时范围依赖项的Maven项目。 I want to call this jar class directly from command line. 我想直接从命令行调用此jar类。 I don't have the option to make fat jar. 我没有选择制作胖子罐。 My Jar structure is:- 我的Jar结构是:-

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. 假设我想直接从命令行调用two.jar的Temp1类。

java -cp "path" "classname" java -cp“路径”“类名”

eg : java -cp C:\\one.jar com.test.main.temp 例如: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 java -cp /usr/local/jar/one.jar:/some/other/two.jar com.your.main.classname

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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