-1

I wrote a working program with java using the teamspeak3API. I haven't changed the code or the jar, so it is exactly the same jar as before. I stopped the program and restarted it, and it caused this error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/theholywaf
fle/teamspeak3/api/wrapper/Client
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.privateGetMethodRecursive(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.github.theholywaffle.teamspeak3
.api.wrapper.Client
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 7 more

I use Oracle JRE v8 update 151 on Windows Server 2008. I also tried restarting the root, reinstalling java and re-import the library into the jar through eclipse.

The jar is running fine on local dev environment but don't in productive server environment.

John_H_Smith
  • 334
  • 2
  • 12

1 Answers1

0

It seems you cannot found one of your class, check your classpath.

TheCodeKiller
  • 1,733
  • 2
  • 12
  • 18
  • Check also that the class in available in these jars – TheCodeKiller Oct 26 '17 at 15:16
  • as written above, I have not changed the jar or replaced it. It is exactly the same jar as before which was working. – John_H_Smith Oct 26 '17 at 15:18
  • You said you "re-import the library into the jar through eclipse." How do you run it ? Through eclipse ? Did you check the jar order ? – TheCodeKiller Oct 26 '17 at 15:22
  • If I run it though eclipse(local on pc) it works without any problems. Run at the server (external) it gives the error above. – John_H_Smith Oct 26 '17 at 15:28
  • Then, to echo what @TheCodeKiller said, that would mean when you run this externally, it seems the (external) server cannot find one of your classes, and you should check your classpath. ClassNotFoundException is pretty specific. See https://stackoverflow.com/questions/17408769/how-do-i-resolve-classnotfoundexception – Michael Peacock Oct 26 '17 at 15:34
  • So why was the exactly same jar file working before I restarted the program? – John_H_Smith Oct 26 '17 at 15:39
  • Okay, I don't know why but this was the reason. Thank you very much! – John_H_Smith Oct 26 '17 at 15:51