title: NoClassDefFoundError with Executable Jar
body: <p>Probably a very usual problem with exec jar. I am trying to create and run an executable jar and its driving me crazy.</p>
  
  <p>I have couple of classes(with package stmts), one of which has a main method, a simple empty constructor and ofcourse few biz methods, these form part of a small eclipse project.<br>
  I am bundling both these and a manifest file into a jar(arc.jar) using a build.xml. My program uses jdom library and also references from one of my other eclipse projects, so I am including both the jdom libray and other biz library while building my arc.jar.  </p>
  
  <p>This is the Manifest.MF I wrote, there is a new lineafter Main-Class   </p>
  
  <pre><code>Manifest-Version: 1.2  
  Class-Path: jdom.jar other.jar
  Main-class: uk.co.Art 
  </code></pre>
  
  <p>When I unzip this arc.jar, it contains jdom.jar, other.jar, META-INF/Manifest.mf and the package with my classes. 
  Funnily, the Manifest file in jar looks like this - </p>
  
  <pre><code>Manifest-Version: 1.2 
  Created-By: 14.2-b01 (Sun Microsystems Inc.) 
  Main-class: uk.co.Art
  Class-Path: jdom.jar other.jar
  </code></pre>
  
  <p>I got the ClassNotFoundException <code>ClassNotFoundException: uk.co.Art</code> when the value of Main class was without the package. With package the error changed to <code>ClassNotFoundException: org.jdom.JDOMException</code>.<br>
  So just for testing purpose, I tried giving the fullpaths with <code>c:\</code> for both my executing class and the jars but still it is not able to locate the main class, errors out <code>ClassNotFoundException: uk.co.Art</code>.<br>
  I cant seem to understand why.<br>
  The command line I am using is - <code>java -jar Arc.jar</code><br>
  The version on cmd prompt is -<br>
  <code>java version "1.6.0_16"<br>
  Java(TM) SE Runtime Environment (build 1.6.0_16-b01)<br>
  Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode)</code><br>
  while the eclipse installed jre is jre6 </p>
  
  <p>What can you folks suggest ?</p>
  
  <blockquote>
    <p>Alex' solution did solve the problem for local execution.<br>
    I am also thinking of another way(as an extra option) of execution, to deploy the Arc.jar on server and run a batch on that machine which basically sets the java classpath and then calls either the jar or directly the class whichever way it works. <code>But its only an option, not a preferred one though.</code><br>
    Or, also, set that classpath in my manifest and build jar locally and deploy on the server.<br>
    Would like to try out a few things though. <code>But now I understand that the basic problem was jars into jar and hence classpath issue.</code></p>
  </blockquote>
  
  <p>Thanks a lot folks.</p>