I’m having some issues exporting my jar file. I have a run.bat file saying “Hey, run this jar file”. Every time it runs I get the following error:
C:\Users\Matt\Desktop>java -jar server.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/esotericsoftware/
kryonet/Server
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.esotericsoftware.kryonet.Server
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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
Press any key to continue . . .
I’m using the Kryonet library with this project. Now I’ve looked around to see if there are any fixes for this error, they all say make sure you have the kryonet.jar checked for the export and make sure its in your classpath. I have double and triple checked that the jar is included in the lib folder in the exported jar, and that its in the classpath. The kryonet.jar is definitely part of the build path and is checked for export in the Order and Export tab.
It runs perfectly in Eclipse but it refuses to run when exported.
This is my classpath in the exported jar: http://pastebin.com/8KtCRUuq