简体   繁体   English

如何使用外部类路径执行可运行的jar?

[英]How can I execute a runnable jar with external classpath?

I'm trying to run a Runnable Jar in JAVA with an external jars folder as its classpath on Linux . 我正在尝试在JAVA使用外部jars文件夹作为其在Linux类路径在JAVA运行可运行Runnable Jar

java -cp "/path/to/jars/*" -jar app.jar

But I'm receiving NoClassFound exception for a class that in the jars folder. 但是我收到jars文件夹中的类的NoClassFound异常。 What am I doing wrong? 我究竟做错了什么?

Use full jar name in classpath. 在类路径中使用完整的jar名称。 Like 喜欢

java -classpath /java/MyClasses/myclasses.jar utility.myapp.Cool

if you have more than one jar, then append them to the classpath with 'OS' separator. 如果您有多个jar,请使用“ OS”分隔符将其附加到类路径。

java -classpath /java/MyClasses:/java/OtherClasses ...

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

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