title: javax.media.NoPlayerException: Cannot find a Player for wav files in jar
body: <p>I use Java Media Framework 2.1.1 for playing sounds in my application. It works fine from IDE but once I make jar package. The <code>Player</code> objects cannot be initialized with exception:  </p>
  
  <pre><code>javax.media.NoPlayerException: Cannot find a Player for :jar:file:...
  </code></pre>
  
  <p>I create players using  <code>javax.media.Manager.createPlayer(URL sourceURL)</code>  method. I suspect that the URL from jar is causing the problems.<br>
  Is there an alternative way how to construct the player with files from jar?</p>
  
  <p>Code:</p>
  
  <pre><code>   public SoundPlayer() {
           urlExplosion = ResourceLoader.getInstance().getSoundResourceUrl(SoundResource.EXPLOSION);
           urlTick = ResourceLoader.getInstance().getSoundResourceUrl(SoundResource.TICK);
           urlWin = ResourceLoader.getInstance().getSoundResourceUrl(SoundResource.WIN);
  
  
      }
  
      public void initialize() throws ResourceLoadingException{
          try {
              explosionPlayer = Manager.createPlayer(urlExplosion);
              explosionPlayer.realize();
              tickPlayer = Manager.createPlayer(urlTick);
              tickPlayer.realize();
              winPlayer = Manager.createPlayer(urlWin);
              winPlayer.realize();
  
          } catch (NoPlayerException e) {
              throw new ResourceLoadingException("Could not initialize the sound player",e);
          } catch (IOException e) {
              throw new ResourceLoadingException("Could not initialize the sound player",e);
          }
  
          isInitialized = true;
      }
  </code></pre>
  
  <p>Note: the URLs are no null during runtime.</p>
  
  <p>Error when run from command line: <code>java -jar minesweeper.jar</code></p>
  
  <pre><code>Caused by: javax.media.NoPlayerException: Cannot find a Player for :jar:file:/path/to/app/minesweeper.jar!/my/package/minesweeper/gui/explosion.wav
  </code></pre>