title: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory after building .jar with NetBeans
body: <p>I moved my project over from eclipse to netbeans and I am now receiving <code>Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory</code> error when I try to run the .jar file after building it. The program runs fine from </p>
  
  <p>Here is what I have in my classpath:</p>
  
  <pre><code>slf4j-api-1.7.11.jar
  slf4j-ext-1.7.11.jar
  log4j-1.2.17.jar
  </code></pre>
  
  <p>Here is my logger:</p>
  
  <pre><code>import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  public class Log {
  
      public static final Logger logger = LoggerFactory.getLogger(Log.class); 
  
      public Log(){
  
      }
  }
  </code></pre>
  
  <p>log4j.properties:</p>
  
  <pre><code># Root logger option
  log4j.rootLogger=INFO, file
  
  # Direct log messages to a log file
  log4j.appender.file=org.apache.log4j.RollingFileAppender
  
  #Redirect to Tomcat logs folder
  #log4j.appender.file.File=${catalina.home}/logs/logging.log
  
  log4j.appender.file.File=C:\\Log.log
  log4j.appender.file.MaxFileSize=10MB
  log4j.appender.file.MaxBackupIndex=10
  log4j.appender.file.layout=org.apache.log4j.PatternLayout
  log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
  </code></pre>
  
  <p>What I call when I want to log something (and this is where it bombs out and throws that error):</p>
  
  <pre><code>Log.logger.info("");
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
  Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
          at com.xxx.xxxx.Log.&lt;clinit&gt;(Log.java:8)
          at com.xxx.xxxx.MainGui.PrintHeaderForLog(MainGui.java:319)
          at com.xxx.xxxx.MainGui.&lt;init&gt;(MainGui.java:69)
          at com.xxx.xxxx.MainGui.&lt;clinit&gt;(MainGui.java:48)
  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)
          ... 4 more
  </code></pre>