Java FX在IDE上,无法使用Scene Builder打开fxml文件

时间:2019-03-23 22:24:51

标签: javafx scenebuilder

当我尝试在IDE上使用SceneBuilder打开fxml时出现错误(请确保选择了有效的FXML文件):

java.io.FileNotFoundException: C:\Users\RafaĹ‚\Documents\NetBeansProjects\JavaFXApplication2\src\javafxapplication2\FXMLDocument.fxml (System nie może odnaleźć określonej ścieżki)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
    at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
    at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
    at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.readContentFromURL(FXOMDocument.java:389)
    at com.oracle.javafx.scenebuilder.app.DocumentWindowController.loadFromFile(DocumentWindowController.java:385)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performOpenFiles(SceneBuilderApp.java:665)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp$1.invalidated(SceneBuilderApp.java:517)
    at javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:136)
    at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
    at javafx.base/javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:72)
    at javafx.base/javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:103)
    at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:111)
    at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
    at com.oracle.javafx.scenebuilder.kit.library.user.UserLibrary.lambda$updateFirstExplorationCompleted$6(UserLibrary.java:352)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)

我在IDE选项路径中设置了Scene Builder

  • 在NetBeans上,我无法选择SB.exe,所以我将文件夹设置为C:\ Program Files \ SceneBuilder

  • 在Eclipse上,我设置了SB.exe

  • Windows SB.exe上的
  • 正常工作

请帮助我。我该怎么做才能开始使用SceneBuilder?

1 个答案:

答案 0 :(得分:0)

我认为这是一个错误,解决方法是

  1. 第一次在IDE外部打开场景构建器
  2. 单击文件-打开- YourFXMLFilename.fxml
  3. 尝试在IDE内打开另一个FXML文件