0

I'm using log4j and slf4j in my application. I put it into jar. My manifest looks like this

Manifest-Version: 1.0
Main-Class: org.runner.Main

My jar file located in the same folder as jars log4j-1.2.17.jar and etc. But when I try to run it I've got an error.

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at org.runner.control.environment.classes.utils.JxdlProperties.<init>(JxdlProperties.java:20)
    at org.runner.Main.main(Main.java:25)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    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)
    ... 2 more

How to run it with dependencies?

lapots
  • 12,553
  • 32
  • 121
  • 242
  • Please read [Adding Classes to the JAR File's Classpath](http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html). – Jin Kwon Jun 20 '14 at 06:41
  • 2
    And here. [executable-jar-with-maven](http://jinahya.wordpress.com/2014/05/22/executable-jar-with-apache-maven/) if you're using maven. – Jin Kwon Jun 20 '14 at 06:43

0 Answers0