title: JavaFx 2.0 application referencing external jars
body: <p>I'm developing a JavaFx 2.0 application using Netbeans 7. 
  The main application references another class library project added by rightclicking the 'Libraries' folder and selecting 'Add Project...'. Executing the application from netbeans works fine.</p>
  
  <p>When deploying it to a jar file by 'Clean and build' and trying to execute it via console with</p>
  
  <pre><code>java -jar TestApp.jar
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>Exception in thread "JavaFX-Launcher" java.lang.NoClassDefFoundError: net/pmoule/SomeClass
  ...
  </code></pre>
  
  <p>The dist/lib folder of my application contains the referenced library. So IMHO everything should be fine. Looking at the Manifest.MF contained in my application jar I get this</p>
  
  <pre><code>Manifest-Version: 1.0
  Ant-Version: Apache Ant 1.8.2
  Created-By: 1.6.0_23-b05 (Sun Microsystems Inc.)
  Implementation-Vendor: pmoule
  Implementation-Title: TestApp
  Implementation-Version: 1.0
  Main-Class: com/javafx/main/Main
  JavaFX-Application-Class: testapp.TestApp
  JavaFX-Version: 2.0
  </code></pre>
  
  <p>Where is my class path? How do I get Netbeans to add the correct classpath?</p>
  
  <p>I tried adding it manually to the Manifest.MF by editing the one contained in the jar</p>
  
  <pre><code>Manifest-Version: 1.0
  Ant-Version: Apache Ant 1.8.2
  Created-By: 1.6.0_23-b05 (Sun Microsystems Inc.)
  Implementation-Vendor: pmoule
  Implementation-Title: TestApp
  Implementation-Version: 1.0
  Class-Path: lib/MyLib.jar        //THIS IS NEW
  Main-Class: com/javafx/main/Main
  JavaFX-Application-Class: testapp.TestApp
  JavaFX-Version: 2.0
  </code></pre>
  
  <p>No success and same error.</p>
  
  <p>All samples delivered with the JavaFX 2.0 SDK work by doubleclicking in WindowsExplorer or from the console by entering e.g.</p>
  
  <pre><code>java -jar PathAnimation.jar
  </code></pre>
  
  <p>But not any of these examples makes a reference to an external jar.</p>
  
  <p>Some research lead me to this question: <a href="https://stackoverflow.com/q/6268215/852274">Netbeans JavaFX 2.0 Application</a>
  But without any solution so far.</p>
  
  <p>Thanks for any help!</p>