title: how can i run an applet as an application?
body: <p>I have an Applet class, and I want to make it run as an application, so I wrote to following code:</p>
  
  <pre><code>public static void main(String args[]) {
  JFrame app = new JFrame("Applet Container");
  app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  app.setSize(200, 100);
  Hangman applet = new Hangman();
  applet.init();
  app.setLayout(new BorderLayout());
  app.setSize(500,500);
  app.getContentPane().add(applet, BorderLayout.CENTER);
  app.setVisible(true);
  }
  </code></pre>
  
  <p>Note: Hangman is the applet class. And if i run it, it work fine, but what I am tring to do, is to make it run as an application.</p>
  
  <p>When I run the above main, I got the following error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
  at java.applet.Applet.getCodeBase(Applet.java:152)
  at Me.Hangman.init(Hangman.java:138)
  at Me.Client.main(Client.java:54)
  Java Result: 1
  </code></pre>
  
  <p>This error is came from this line in the Hangman class:</p>
  
  <pre><code>danceMusic = getAudioClip(getCodeBase(), "../../audio/dance.au");
  </code></pre>
  
  <p>GetCodeBase() method returns null, I need help on how can I make this method work properly, or maybe replace it with another method that may access my files to get resources?</p>
  
  <p>Thank you in advance </p>