编译JavaFX应用程序时出错

时间:2013-04-23 14:15:46

标签: java javafx-2 javafx fxml scenebuilder

我是java的新手,我正在尝试使用JavaFX按照tutorial在eclipse上构建一个e(fx)clipse应用程序并完全相同,应用程序非常简单,当我尝试编译它时,我得到一堆我甚至不理解的错误:

Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403)
    at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Location is not set.
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2021)
    at ch.makery.address.controler.MainApp.start(MainApp.java:29)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
    at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:67)
    ... 1 more

请告诉我我错过了什么。

1 个答案:

答案 0 :(得分:0)

您必须在loader中设置FXML文件的位置,并确保为FXML文件提供正确的PATH

PS: NetbeansJavaFX初学者的最佳选择,启动Here