使用Jaunt Library时ClassNotFoundException和NoClassDefFoundError?

时间:2017-09-15 15:11:44

标签: java linux noclassdeffounderror classnotfoundexception jaunt-api

我正在使用Jaunt库处理Web scraper。我目前在linux终端上遇到运行时错误:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/jaunt/JauntException
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
        at java.lang.Class.getMethod0(Class.java:3018)
        at java.lang.Class.getMethod(Class.java:1784)
        at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.jaunt.JauntException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 7 more
跑步时

java -cp .:.classes/jaunt1.3.3.jar class_name

我的.jar文件的目录如下所示:

leo@blah:~/workspace/Java/classes$ ls -al
total 164
drwxrwxr-x 2 leo leo   4096 Sep 13 17:25 .
drwxrwxr-x 4 leo leo   4096 Sep 15 10:59 ..
-rw-rw-r-- 1 leo leo 157786 Sep 11 19:40 jaunt1.3.3.jar

我的classpath看起来像这样:

leo@blah:~/workspace/Java/classes$ echo $CLASSPATH
~/workspace/Java/classes:home/leo/workspace/Java/classes/:home/leo/workspace/Java/classes/jaunt1.3.3.jar

有人可以帮帮我吗?谢谢!

0 个答案:

没有答案