The Computer configuration is: Win7 flagship 64-bit, JDK and Eclipse are 64-bit, download JMF is jmf-2_1_1e-windows-i586, this thing online many people say only support 32-bit JDK, as you expected. Download down is also not installed;On cue said overwrite protection window and said I C-plate under:C:\Users\pengrong\AppData\Local\Temp file is overwritten, whether the choice is yes or no is not installed, I always choose Yes to all, and then all the eggs, and finally all said to the JDK to 32-bit, this is not to die. So there is no installation can also use the post, and then I did not use his post. (You can use JMF for details without installing JMF). I'm using the second method, I entered the tip sayinghint says overwrite protection window under theC:\Users\pengrong\AppData\Local\Temp\ .... I found a setup.exe executable file, double-click it and I'll just load it up. JMF
Because I was installed by default, the installation location is in C:\Program Files (x86) \jmf2.1.1e, so the classpath, PATH environment variable will be configured immediately. Direct access
Find Classpath and add Jmf.jar and Sound.jar, respectively.
C:\Program Files (x86) \jmf2.1.1e\lib\jmf.jar;
c:\program Files (x86) \jmf2.1.1e \lib\sound.jar;
(where C:\Program Files (x86) \jmf2.1.1e is the installation path for your JFM )
C. Find path, add dynamic Library
C:\Program Files (x86) \jmf2.1.1e\ Bin;
Tip: After each addition, don't forget the semicolon behind
And then I can use a simple routine to test the music in the MP3 format. Can it be sung by the sound?
Package Com.playmusic;import javax.media.ControllerEvent; Import Javax.media.ControllerListener; Import javax.media.NoPlayerException; Import Javax.media.Player; Import Javax.media.Manager; Import Javax.media.MediaLocator; Import javax.media.EndOfMediaEvent; Import javax.media.PrefetchCompleteEvent; Import javax.media.RealizeCompleteEvent; Import java.io.*; Import java.util.*; public class Playermusic implements Controllerlistener {//Playback object private player player; Whether to loop the private Boolean first,loop; File path private String path; Store MP3 File Reference private list<string> mp3list; Current number of MP3 files private int mp3no=0; Playermusic (list<string> mp3list) {this.mp3list=mp3list; }//Play method public void Start () {try {player = Manager.createplayer (new File (Mp3list.get (mp3no)). Touri (). Tourl () ); } catch (Noplayerexception e) {//TODO automatically generate catch block E.printstacktrace (); System.out.println ("Cannot play this file! "); Return } catch (IOException e) {//TODO automatically generate catch block E.PRintstacktrace (); Return } if (Player==null) {System.out.println ("Play File is empty! "); Return } player.addcontrollerlistener (this); Extract Media content Player.prefetch (); } public static void Main (string[] args) {list<string> path=new arraylist<string> (); Just add the full path of the MP3 music to the path list to Okpath.add ("F:/workstation/tankewar4/cto tank war all Sound/start. mp3"); Path.add ("F:/workstation/tankewar4/cto tank war all sound effects/maid with the flaxen Hair.mp3"); Playermusic play=new playermusic (path); Play.start (); } @Overridepublic void Controllerupdate (Controllerevent e) {//When a song is played at the end, play the next song if (e instanceof endofmediaevent) {mp3 no++; System.out.println (mp3no); if (Mp3no<mp3list.size ()) {This.start (); } return; }//When the content of the extracted media ends if (e instanceof prefetchcompleteevent) {System.out.println ("End of content"); Player.start (); Return }//When instantiated if (e instanceof realizecompleteevent) {System.out.println ("instanced"); Pack (); Perform a pack () operation return; } } }
Of course, at the end of the work, I do not know why to do this, not to specify the path of Classpath.
You need to be in Eclipse, Project->properties, Java build path, libraries; Select Add External JARs
Add Jmf.jar and Sound.jar and everything will be all right. Good luck
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Jmf-java Media framwork Installation Issues