Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMF can't play media file in a jar file

 
Caven Wang
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JMF to play a sound file(ot.au). My applet works in and out of my JBuilder. When I put all stuff into a jar file, it reports:
javax.media.NoPlayerException: Cannot find a Player for :jar:file:/H:/player.jar!/data/ot.au
my code:
...
try {url=this.getClass().getResource(mediaFile) ;
} catch (Exception mue) { mue.printStackTrace() ; }
...
try {player=Manager.createPlayer( url);
} catch (NoPlayerException e) {
System.out.println(e); }
 
Peter Gragert
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I lately needed *.gif files (pictures for JLabels).
I put it in a jar file too: does not work either.
Solution was: not in the jar but at a (relative) dir
where the jar file lives!
.../your.jar
.../audio/*.*
and then read from audio e.g.
Peter
 
Caven Wang
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Peter
When resource files, such as media or images, are included in a jar file, the applet can run faster. At least the applet can save time to download its multimedia resource. I make it while loading an image from a jar file. Sound is also OK. The big problem is that JMF cann't make it!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic