5 Replies - 5074 Views - Last Post: 14 August 2010 - 10:45 AM Rate Topic: -----

#1 Tapas Bose  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 23
  • View blog
  • Posts: 472
  • Joined: 09-December 09

How to use JMF ?

Posted 14 August 2010 - 09:22 AM

Hello everybody. I have installed JMF in my Windows 7 and working with it there along with Swing. For testing purpose I executed the executable jar file from Windows XP and there JMF is not installed and I am getting errors and can not able to play mp3 from XP. What should I do now? Any suggestion will be very helpful to me.
Thank you.
Is This A Good Question/Topic? 0
  • +

Replies To: How to use JMF ?

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8316
  • View blog
  • Posts: 31,836
  • Joined: 06-March 08

Re: How to use JMF ?

Posted 14 August 2010 - 09:57 AM

Why don't you also install JMF on your XP ?
Was This Post Helpful? 1
  • +
  • -

#3 Tapas Bose  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 23
  • View blog
  • Posts: 472
  • Joined: 09-December 09

Re: How to use JMF ?

Posted 14 August 2010 - 10:08 AM

Thank you for giving reply sir.
It is a part of my project. So I shall might have to show/execute it in a computer where I can not install JMF.
I am also using some extra jar library, like AbsoluteLayout, Nimrod Look and feel. I put these in my resources sub-folder of src and I test my work in XP, where I installed only JRE (As I think in college's computer have JRE installed only). I transfer only executable jar file along with lib directory of dist folder to XP for testing. Hope you understand sir what I am talking about. Sir how can I do this.
Thank you.
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8316
  • View blog
  • Posts: 31,836
  • Joined: 06-March 08

Re: How to use JMF ?

Posted 14 August 2010 - 10:10 AM

So add the JMF.jar into your own .jar.

P.S.
You will have to decompress it before re-inserting it into your .jar.
Was This Post Helpful? 1
  • +
  • -

#5 Tapas Bose  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 23
  • View blog
  • Posts: 472
  • Joined: 09-December 09

Re: How to use JMF ?

Posted 14 August 2010 - 10:21 AM

Thank you sir.
JMF .jar means C:\Program Files\JMF2.1.1e\lib\jmf.jar?
Sir will I add this in that way like Nimrod?
Was This Post Helpful? 0
  • +
  • -

#6 Tapas Bose  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 23
  • View blog
  • Posts: 472
  • Joined: 09-December 09

Re: How to use JMF ?

Posted 14 August 2010 - 10:45 AM

Thank you sir. It is working. I did it as you instructed me. And I am not getting "class not found error" in cmd of XP. But also not able to here any sound. I put my mp3 file in resources folder of src. In /dist/lib, there is no .mp3 file but all other .jar libraries are there. In my program I used file reference as :
MP3 mp3 = new MP3("file:///C://Users//Tanmoy//Documents//NetBeansProjects//Super Scientific Calculator//src//resources//what_the_hell.mp3");

And the MP3 class is :
package mp3player;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.media.*;

/**
 *
 * @author Tanmoy
 * @Super Scientific Calculator
 * @version 1.2010
 *
 */

public class MP3 extends Thread {
	private URL url;
	private MediaLocator mediaLocator;
	private Player playMP3;

	public MP3(String mp3) {
		try {
			this.url = new URL(mp3);
		} catch (MalformedURLException ex) {
			Logger.getLogger(MP3.class.getName()).log(Level.SEVERE, null, ex);
		}
		if (url == null) {
			System.out.println("1");
		} 
	}

	public void run() {

		try {
			mediaLocator = new MediaLocator(url);
			playMP3 = Manager.createPlayer(mediaLocator);
		} catch (java.io.IOException e) {
			System.out.println(e.getMessage());
		} catch (javax.media.NoPlayerException e) {
			System.out.println(e.getMessage());
		}

		playMP3.addControllerListener(new ControllerListener() {

			public void controllerUpdate(ControllerEvent e) {
				if (e instanceof EndOfMediaEvent) {
					playMP3.stop();
					playMP3.close();
				}
			}
		});
		playMP3.realize();
		playMP3.start();
	}
}


Sir how to specify the location of the file during execution. Should I pass the path as command line parameter(s)? But what about the case of executing it by clicking the executable jar file?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1