I recently installed JMF and think i set the classpath and path variable correctly. I then downloaded sample media player code and attempted to compile. My problem is that compiling generates tons of errors that i'm having trouble resolving.(it looks like the classpath is having trouble finding the jmf stuff, i've pasted my classpath vars below) Here are the Errors:
D:\JavaProgzz>javac MoviePlayer.java
MoviePlayer.java:26: cannot resolve symbol
symbol : method stop ()
location: class Player
player.stop();
^
MoviePlayer.java:27: cannot resolve symbol
symbol : method deallocate ()
location: class Player
player.deallocate();
^
MoviePlayer.java:36: incompatible types
found : javax.media.Player
required: Player
player = Manager.createPlayer(ml);
^
MoviePlayer.java:37: cannot resolve symbol
symbol : method addControllerListener (MoviePlayer)
location: class Player
player.addControllerListener(this);
^
MoviePlayer.java:38: cannot resolve symbol
symbol : method start ()
location: class Player
player.start();
^
MoviePlayer.java:49: cannot resolve symbol
symbol : method getVisualComponent ()
location: class Player
if ((comp = player.getVisualComponent()) != null)
^
MoviePlayer.java:51: cannot resolve symbol
symbol : method getControlPanelComponent ()
location: class Player
if ((comp = player.getControlPanelComponent()) != null)
^
7 errors
---
Here is the Code:
import javax.swing.*;
import javax.media.*;
import javax.media.protocol.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class MoviePlayer extends JFrame implements ControllerListener {
private Player player = null;
public static void main(
String args[]) {
new MoviePlayer(args[0]);
}
public MoviePlayer(String movieFile) {
getContentPane().setLayout(new BorderLayout());
setSize(new Dimension(200, 200));
setVisible(true);
setTitle(movieFile);
loadMovie(movieFile);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
player.stop();
player.deallocate();
System.exit(1);
}
});
}
private void loadMovie(String movieFile) {
try {
MediaLocator ml = new MediaLocator("file:" + movieFile);
player = Manager.createPlayer(ml);
player.addControllerListener(this);
player.start();
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (NoPlayerException npe) {
npe.printStackTrace();
}
}
public synchronized void controllerUpdate(ControllerEvent ce) {
if (ce instanceof RealizeCompleteEvent) {
Component comp;
if ((comp = player.getVisualComponent()) != null)
getContentPane().add(comp, BorderLayout.CENTER);
if ((comp = player.getControlPanelComponent()) != null)
getContentPane().add(comp, BorderLayout.SOUTH);
validate();
}
}
}
Here are my Environment Variables:
classpath: C:\JMF2.1.1e\lib\jmf.jar;C:\JMF2.1.1e\lib\sound.jar;.;C:\j2sdk1.4.2_04\lib\tools.jar;.
path: C:\JMF2.1.1e\lib;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\j2sdk1.4.2_04\bin;.;%JMFDIR%\lib;
jmfdir: C:\JMF2.1.1e
-- the 'lib' folder is in c:\jmf2.1.1e
-- lib folder contains jmf.jar and tools.jar
Please, any help appreciated
advTHANKSance