Reputation: 1006
I'm trying to run my project outside of my IDE and I'm getting this java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
It works fine inside the IDE but when trying to run it from a batch file it's loading the application panel and throwing this error.
I have included all of the libraries in the batch file, all of them are present and they are the same libraries that are used inside of the IDE.
java -cp bin;deps/InetAddressLocator.jar;deps/lombok.jar;deps/commons-collections4-4.0.jar;deps/mina-core-1.1.7.jar;deps/mysql.jar;deps/slf4j-api-1.6.1;deps/slf4j-simple-1.6.1.jar; game.engine.GameEngine true 0 0
pause
How can I fix this?
[02/06/2014 12:42:52 AM]: Exception in thread "main"
[02/06/2014 12:42:52 AM]: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
[02/06/2014 12:42:52 AM]: at org.apache.mina.util.NamePreservingRunnable.<init>(NamePreservingRunnable.java:32)
[02/06/2014 12:42:52 AM]: at org.apache.mina.transport.socket.nio.SocketAcceptor.startupWorker(SocketAcceptor.java:165)
[02/06/2014 12:42:52 AM]: at org.apache.mina.transport.socket.nio.SocketAcceptor.bind(SocketAcceptor.java:141)
[02/06/2014 12:42:52 AM]: at game.engine.GameEngine.main(GameEngine.java:125)
[02/06/2014 12:42:52 AM]: Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
[02/06/2014 12:42:52 AM]: at java.net.URLClassLoader$1.run(Unknown Source)
[02/06/2014 12:42:52 AM]: at java.net.URLClassLoader$1.run(Unknown Source)
[02/06/2014 12:42:52 AM]: at java.security.AccessController.doPrivileged(Native Method)
[02/06/2014 12:42:52 AM]: at java.net.URLClassLoader.findClass(Unknown Source)
[02/06/2014 12:42:52 AM]: at java.lang.ClassLoader.loadClass(Unknown Source)
[02/06/2014 12:42:52 AM]: at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[02/06/2014 12:42:52 AM]: at java.lang.ClassLoader.loadClass(Unknown Source)
[02/06/2014 12:42:52 AM]: ... 4 more
Upvotes: 0
Views: 2688
Reputation: 562
In java -cp bin;deps/InetAddressLocator.jar;deps/lombok.jar;deps/commons-collections4-4.0.jar;deps/mina-core-1.1.7.jar;deps/mysql.jar;deps/slf4j-api-1.6.1;deps/slf4j-simple-1.6.1.jar; game.engine.GameEngine true 0 0
slf4j-api-1.6.1 is mising the ".jar" at the end. It should read as "slf4j-api-1.6.1.jar"
Upvotes: 2