title: Why is jar file not being found with classpath spec? (FileChooserDemo from Oracle)
body: <p>Downloaded the latest Java SE. Ran FileChooserDemo via JNLP at <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html" rel="nofollow">http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html</a> 
  Works fine. (Windows box.)</p>
  
  <p>Downloaded the source from <a href="http://docs.oracle.com/javase/tutorial/uiswing/examples/components/index.html#JWSFileChooserDemo" rel="nofollow">http://docs.oracle.com/javase/tutorial/uiswing/examples/components/index.html#JWSFileChooserDemo</a> </p>
  
  <p>Following the compile instructions in the java source: </p>
  
  <pre><code>C:components&gt; javac -classpath .;jars/jnlp.jar JWSFileChooserDemo.java 
  </code></pre>
  
  <p>This works fine. Two class files are generated in the components dir. Then... </p>
  
  <pre><code>C:components&gt;cd .. 
  C:src&gt; java -classpath .;jars/jnlp.jar components.JWSFileChooserDemo 
  Exception in thread "main" java.lang.NoClassDefFoundError:javax/jnlp/UnavailableServiceException 
  at java.lang.Class.getDeclaredMethods0(Native Method) 
  . 
  . 
  . 
  </code></pre>
  
  <p>So the <code>UnavailableServiceException.class</code> isn't being found. But if you list the jar file, the class IS there. So my classpath is just wrong. </p>
  
  <pre><code>C:jars&gt; tar tf jnlp.jar
  META-INF/
  META-INF/MANIFEST.MF
  javax/jnlp/
  javax/jnlp/BasicService.class
  javax/jnlp/ClipboardService.class
  javax/jnlp/DownloadService.class
  javax/jnlp/DownloadServiceListener.class
  javax/jnlp/ExtensionInstallerService.class
  javax/jnlp/FileContents.class
  javax/jnlp/FileOpenService.class
  javax/jnlp/FileSaveService.class
  javax/jnlp/JNLPRandomAccessFile.class
  javax/jnlp/PersistenceService.class
  javax/jnlp/PrintService.class
  javax/jnlp/ServiceManager.class
  javax/jnlp/ServiceManagerStub.class
  javax/jnlp/UnavailableServiceException.class
  </code></pre>
  
  <p>I tried this on Mac OSX (you have to change semicolons into colons in the classpath) and same exact thing. </p>
  
  <p><strong>Update:</strong> I found an older version of this demo online that doesn't use <code>UnavailableSewrviceException</code> and compiles standalone.  It works fine with current Java and suits my purposes.  I still do not understand why the commands given above do not work.</p>