0

I am working on a web scraper using the Jaunt library. I am currently getting the runtime error while on the linux terminal:

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

while running:

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

The directory of my .jar file looks like this:

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

and my classpath looks like this:

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

Can someone help me out? Thanks!

  • Do you need `.|./classes`, rather than `.:.classes` ? I don't think you have a directory called "dot-classes", but a directory called "classes". – Kevin Boone Sep 15 '17 at 16:28
  • @KevinBoone now it is treating the jar file as an executable and giving me the error: "cannot execute binary file: Exec format error" so I do not think that is right. In linux, the colon is just used to add to the classpath – Otis Sistrunk Sep 15 '17 at 16:49
  • @KevinBoone Ah you were right, all I needed to do was remove the "." before the "classes" directory. Thank you! – Otis Sistrunk Sep 15 '17 at 16:54

0 Answers0