Hi there. I have got a problem here. I have compiled a file from QuickTime Java Demo. And after compilation, I tried to run it, but it is not able to run. Does anybody know what is the problem? The script is below:
/*
* QuickTime for Java SDK Sample Code
Usage subject to restrictions in SDK License Agreement
* Copyright: ? 1996-1999 Apple Computer, Inc.
*/
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.io.IOException;
import quicktime.*;
import quicktime.io.*;
import quicktime.qd.*;
import quicktime.std.*;
import quicktime.std.movies.*;
import quicktime.std.movies.media.*;
import quicktime.app.display.*;
import quicktime.app.players.*;
publicclass PlayMovie extends Frame implements Errors {
publicstaticvoid main (String args[]) {
try {
QTSession.open();
// make a window and show it - we only have one window/one movie at a time
PlayMovie pm = new PlayMovie("QT in Java");
pm.show();
pm.toFront();
} catch (QTException e) {
// at this point we close down QT if an exception is generated because it means
// there was a problem with the initialization of QT>
e.printStackTrace();
QTSession.close ();
}
}
public PlayMovie (String title) {
super (title);
myQTCanvas = new QTCanvas();
new FileMenu (this);
add(myQTCanvas);
addWindowListener(new WindowAdapter () {
publicvoid windowClosing (WindowEvent e) {
goAway();
}
publicvoid windowClosed (WindowEvent e) {
System.exit(0);
}
});
}
private QTDrawable myPlayer;
private Movie m;
private QTCanvas myQTCanvas;
// This will resize the window to the size of the new movie
publicvoid createNewMovieFromURL (String theURL) {
try {
// create the DataRef that contains the information about where the movie is
DataRef urlMovie = new DataRef(theURL);
// create the movie
m = Movie.fromDataRef (urlMovie,StdQTConstants.newMovieActive);
// This shows the steps to use the three different Objects to present a Movie
// QTPlayer -> presents the MovieController allowing the user to interact with the movie and control its playback/presentation
// MoviePlayer -> presents the Movie directly to the screen - application could provide its own controls
// MoviePresenter -> puts the Movie into an offscreen buffer, the buffer is then drawn to the screen - application could provide its own controls
if (true) { // QTPlayer
MovieController mc = new MovieController (m);
mc.setKeysEnabled (true);
myPlayer = new QTPlayer (mc);
} elseif (false) { // make a MoviePlayer version
myPlayer = new MoviePlayer (m);
} elseif (false) { // make a MoviePresenter out of this
myPlayer = new MoviePresenter (m);
}
myQTCanvas.setClient (myPlayer, true);
// this will set the size of the enclosing frame to the size of the incoming movie
pack();
//no user control over MoviePlayer or MoviePresenter so set rate
if (false)
m.setRate(1);
} catch (QTException err) {
err.printStackTrace();
}
}
public QTDrawable getPlayer () { return myPlayer; }
public QTCanvas getCanvas () { return myQTCanvas; }
public Movie getMovie () throws QTException {
return m;
}
publicstaticvoid goAway () {
QTSession.close();
System.exit(0);
}
void stopPlayer () {
try {
if (m != null)
m.setRate(0);
} catch (QTException err) {
err.printStackTrace();
}
}
}
And the error that I get is: C:\jdk1.2.2\bin>java C:\PlayMovie.class Exception in thread "main" java.lang.NoClassDefFoundError: PlayMovie/class