title: NoClassDefFoundError after updating to Java 7
body: <p>I'm getting the NoClassDefFoundError after executing my project's JAR file.
  Debugging with Eclipse works fine, but I get this error whenever I use the windows command <code>java -jar myproject.jar</code> since I installed JDK 1.7.</p>
  
  <p>It was working fine using Java 1.6.</p>
  
  <p>Here's the error log :</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout
  at program.Main.main(Main.java:20)
  Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Layout
  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)
  ... 1 more
  </code></pre>
  
  <p>I googled about that but couldn't find the right solution.</p>
  
  <p>What I already did :
  -uninstall Java 1.7, install 1.6 instead
  -check the classpath
  -try on an other computer (after uninstalling Java 1.7 from it)
  -create an empty project with one reference to the log4j library => same problem</p>
  
  <p>And here's the classpath file :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;classpath&gt; 
  &lt;classpathentry kind="src" path="src"/&gt; 
  &lt;classpathentry kind="con"path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/&gt;
  &lt;classpathentry kind="lib" path="lib/RXTXcomm.jar"/&gt; 
  &lt;classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/&gt; 
  &lt;classpathentry kind="output" path="bin"/&gt; 
  &lt;/classpath&gt;
  </code></pre>
  
  <p>Do you have any idea what else I should do?</p>
  
  <p>Thanks,</p>
  
  <p>Nils</p>
  
  <p>EDIT : if I export the project as an "runnable JAR" instead of a simple "JAR", the program starts but fail to use another library I'm using (RxtxComm). Here's the log I get:</p>
  
  <pre><code>java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
  </code></pre>
  
  <p>EDIT2: I finally resolved the last problem by putting the rxtxSerial.dll in the Windows/system32 folder.
  But still, I don't understand why it doesn't work anymore if I export my project as a JAR file and why I need to use the dll file now.</p>