title: can't run swing from the command line
body: <p>i use the command line in windows to compile and then execute my java programs. i've gone to <a href="http://java.sun.com/docs/books/tutorial/uiswing/start/compile.html" rel="noreferrer">http://java.sun.com/docs/books/tutorial/uiswing/start/compile.html</a> and tried compiling the HelloWorldSwing.java class. it worked, but when i try "java HelloWorldSwing" it gives me a bunch of erros and says something along the lines of Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldSwing (wrong name: start/HelloWorldSwing)</p>
  
  <p>i try running with java start/HelloWorldSwing and it says noClassDefFoundError. i get no errors with javac either. here's the code from the tutorial:</p>
  
  <pre><code>import javax.swing.*;        
  
  public class HelloWorldSwing {
      /**
       * Create the GUI and show it.  For thread safety,
       * this method should be invoked from the
       * event-dispatching thread.
       */
      private static void createAndShowGUI() {
          //Create and set up the window.
          JFrame frame = new JFrame("HelloWorldSwing");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          //Add the ubiquitous "Hello World" label.
          JLabel label = new JLabel("Hello World");
          frame.getContentPane().add(label);
  
          //Display the window.
          frame.pack();
          frame.setVisible(true);
      }
  
      public static void main(String[] args) {
          //Schedule a job for the event-dispatching thread:
          //creating and showing this application's GUI.
          javax.swing.SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                  createAndShowGUI();
              }
          });
      }
  }
  </code></pre>
  
  <p>EDIT: used javaw</p>
  
  <p>window pops up</p>
  
  <p>"a java exception has occurred"</p>
  
  <p>another window</p>
  
  <p>"error: could not find the main class.
  error: a jni error has occurred, please check your installation and try again."</p>
  
  <p>never had any problems running any java programs, am i missing something? is there a way to know what it is?</p>
  
  <p>i'm also running the command in the same path where the .java and .class are.</p>
  
  <p>there is no folder start in the path where i compiled the program.</p>
  
  <p>EDIT2
  I tried both start/HelloWorldSwing and HelloWorldSwing with java.</p>
  
  <p>I don't get any errors with javac also. I get 2 pop up windows with the messages I've typed previously when I use javaw and java gives me the NoClassDefFoundException, then talks about the ClassLoaders and whatnot.</p>
  
  <p>EDIT3
  I got it to work by removing the "package start;" line. what would i have to do to make it work with that?</p>
  
  <p>javaw also works now that I removed the package line.</p>