简体   繁体   中英

Java Error on Linux OS

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.

You need to do this in order to include the Apache Commons CLI library in your classpath:

java -cp '.:/path/to/cli.jar' -jar jodconverter-cli-2.2.2.jar x.doc y.pdf

If you're on Windows, use a semicolon ; instead of the colon : in specifying the classpaths.

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.

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