我尝试使用JavaFX,但在使用JavaFX中的任何内容时总是出现错误:
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Uncompilable code - cannot find symbol
symbol: class Application
这就是代码:
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
public class NewClass extends Application {
public void start(Stage stage) {
Circle circ = new Circle(40, 40, 30);
Group root = new Group(circ);
Scene scene = new Scene(root, 400, 300);
stage.setTitle("My JavaFX Application");
stage.setScene(scene);
stage.show();
}
}
1条答案
按热度按时间egmofgnx1#
您可能正在使用不包含JavaFX的JDK。有各种方法可以科普这个问题。请查看官方文档:Getting Started with JavaFX