1

我正在尝试使用 javafx 创建一个视频播放器,但是当我尝试运行该类时,它显示了一些错误

public class MoviePlayer extends Application{


public static void main (String [] args){
launch(args);
}

@Override
public void start(Stage stage) throws Exception {
    Group root = new Group();       
    Media media = new Media("C:\\Users\\goldAnthony\\Videos\\Whistle.mp4");

    MediaPlayer player = new MediaPlayer(media);
    MediaView view = new MediaView(player);

    root.getChildren().add(view);
    Scene scene = new Scene(root, 400, 400, Color.BLACK);
    stage.setScene(scene);
    stage.show();

    player.play();
}

这是它显示的错误

Error: Could not find or load main class Player.VideoPlayer2
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

我问过的一些人说代码工作正常,我真的不知道问题出在哪里,因为它在上面给出了这个错误

4

0 回答 0