title: Jar with compressed music with java?
body: <p>I've tried to add music to an application I've made. First I tried with <code>.wav</code> files though they became so huge that the application became too large to upload anywhere.</p>
  
  <p>So I changed the files to <code>.mp3</code>, tried <code>JMF</code> and <code>JLayer</code> though both of them won't work on runnable jars (even if they work fine when I haven't exported them).</p>
  
  <p>So anyone got any tips on how to play compressed music with a runnable jar?</p>
  
  <p>Here's the code for JLayer, when exported it stops working at <code>f = new File(u.toURI())</code> without throwing any exceptions...</p>
  
  <pre><code>try {
  
      URL u = cl.getResource("New Beginnings.mp3");
      f = new File(u.toURI());
  
  } catch (URISyntaxException e1) {
      e1.printStackTrace();
  }
  
  try {
  
      FileInputStream fis = new FileInputStream(f);
      p = new Player(fis);
      p.play();
  
  } catch (Exception e) {
      System.out.println(e);
  }
  </code></pre>
  
  <p>Edit: Fixed with changing the above code to:</p>
  
  <pre><code>try {
  
        InputStream fis = ClassLoader.getSystemClassLoader().getResourceAsStream(temp+".mp3");
        p = new Player(fis);
        p.play();
  
     } catch (Exception e) {
        System.out.println(e);
     }
  </code></pre>