0 Replies - 1515 Views - Last Post: 11 September 2009 - 12:22 PM Rate Topic: -----

#1 JAVADDICT  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 10-September 09

No JMediaPlayer class in Javafx 1.2

Posted 11 September 2009 - 12:22 PM

I was just searching the internet trying to learn how to create a media player. And i discovered the Javafx API but the thing is that i wrote the program based on javafx 1.0 and here's the code:




import java.awt.EventQueue;

import java.net.URI;

import javax.swing.JFrame;

import com.sun.media.jmc.*;

public class MediaPlayer extends JFrame
{
   public MediaPlayer (String mediaURI)
   {
	  super ("MediaPlayer: "+mediaURI);
	  setDefaultCloseOperation (EXIT_ON_CLOSE);

	  JMediaPlayer mp = null;
	  try
	  {
		  mp = new JMediaPlayer (new URI (mediaURI));
	  }
	  catch (Exception e)
	  {
		  System.out.println ("Error opening media: "+e.toString ());
		  System.exit (1);
	  }

	  setContentPane (mp);

	  pack ();
	  setVisible (true);
   }

   public static void main (final String [] args)
   {
	  if (args.length != 1)
	  {
		  System.err.println ("usage: java BMP mediaURI");
		  return;
	  }

	  Runnable r = new Runnable ()
				   {
					   public void run ()
					   {
						  new MediaPlayer (args [0]);
					   }
				   };
	  EventQueue.invokeLater (r);
   }
}




and then i downloaded javafx 1.2 and tried to compile it using

javac -cp jmc.jar MediaPlayer.java (making sure of the file paths)

and i always get the exception that it cannot find the classes JMediaPlayer and URI

what should i do so that i can compile them? and what are these classes subsitutes in the jmc.jar contained in the javafx 1.2? and one more question .. where can i download the javafx 1.0 from because i wasn't able to find it anywhere it was updated to 1.2..
thank you in advance.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1