我想從Linux中的命令行運行一個java項目,我的項目使用兩個外部jar文件。我很安寧的命令是使用classpath問題從命令行運行java項目?
的java -classpath -jar斌:共CLI-1.2.jar:BuildFrameworkLibrary.jar com.kpit.goa.common.tools.kivibuild.KIVIBuild
其中KIVIBuild是包含主要功能的類。但是,我得到的錯誤是:
[email protected]:~/git/KiviBuild/Infra/RepoManagement/BuildManagement/KIVIBuild$ java -classpath bin:common-cli-1.2.jar:BuildFrameworkLibrary.jar com.kpit.goa.common.tools.kivibuild.KIVIBuild
給人
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: com.kpit.goa.common.tools.kivibuild.KIVIBuild. Program will exit.
是'ParseException'內部包含'共CLI-1.2.jar'? –
'java -classpath「。:bin/common-cli-1.2.jar:bin/BuildFrameworkLibrary.jar」com.kpit.goa.common.tools.kivibuild.KIVIBuild' – Khinsu