Linux 操作系统上的 Java 错误
大家好,我试图弄清楚为什么当我尝试在 Linux 系统上从 Shell 运行此 API 时出现此错误。
[~/public_html/test/]# java -jar jodconverter-cli-2.2.2.jar Amritpal.doc example.pdf
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/CommandLineParser
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.CommandLineParser
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.artofsolving.jodconverter.cli.ConvertDocument. Program will exit.
Hello Guys I am trying to figure out why i am gettings this error when I am trying to run this API from Shell on my linux System.
[~/public_html/test/]# java -jar jodconverter-cli-2.2.2.jar Amritpal.doc sample.pdf
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/CommandLineParser
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.CommandLineParser
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.artofsolving.jodconverter.cli.ConvertDocument. Program will exit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要执行此操作才能将 Apache Commons CLI 库包含在类路径中:
如果您使用的是 Windows,请在指定时使用分号
;
而不是冒号:
类路径。You need to do this in order to include the Apache Commons CLI library in your classpath:
If you're on Windows, use a semicolon
;
instead of the colon:
in specifying the classpaths.因为您没有在类路径中指定依赖项(第一个正是错误告诉您的内容,apache.commons.cli 库)。
您需要在命令行或该 jar 的清单中指定它们。
Because you don't have the dependencies specified in the classpath (The first one being exactly what the error is telling you, the apache.commons.cli library).
You either need to specify them on the command line or in the manifest in that jar.