我是
javaFX的新手,我正在尝试运行一个简单的应用程序.它的UI是用javaFX场景构建器创建的,Main类应该显示UI,而不是其他.
public class Main extends Application { public static void main(String[] args) { launch(Main.class,(String[])null); } @Override public void start(Stage primaryStage) {; try { AnchorPane root=(AnchorPane)FXMLLoader.load(Main.class.getResource("Main.fxml")); Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.setTitle("Issue Tracking Lite Sample"); primaryStage.show(); } catch (IOException e) {System.err.println(e);} } }
运行应用程序时出现此错误:
No resources specified. /D:/workspace/FileSharing_ServerSide/bin/com/Shayan/FileSharing/Server/Main.fxml:16 at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:305) at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:197) at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:588) at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2430) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2136) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2742) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2721) at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2707) javafx.fxml.LoadException: No resources specified.