Java 打开场景构建器时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24096331/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 10:08:25  来源:igfitidea点击:

Error opening scene builder

javaeclipsejavafx

提问by user3717596

I'm making a program with Javafx Eclipse and I get an error when I open the program with the Scene Builder

我正在使用 Javafx Eclipse 制作程序,当我使用 Scene Builder 打开程序时出现错误

This is the error:

这是错误:

Opening the file with SceneBuilder failed. 
Try setting the absolute path to scenebuilder in your preferences

回答by CrazedCoder

Make sure you are running the latest version of Eclipse. I've tested this with Luna 4.4 as I had the same issue.

确保您运行的是最新版本的 Eclipse。我已经用 Luna 4.4 对此进行了测试,因为我遇到了同样的问题。

Install the latest version of JavaFX Scene Builder. You can find version 2.0 here: http://www.oracle.com/technetwork/java/javase/downloads/sb2download-2177776.html

安装最新版本的 JavaFX Scene Builder。您可以在此处找到 2.0 版:http: //www.oracle.com/technetwork/java/javase/downloads/sb2download-2177776.html

Then set your absolute path to the JavaFX Scene Builder in your preferences:

然后在您的首选项中设置 JavaFX Scene Builder 的绝对路径:

  1. Click on the menu path: Window->Preferences->General->Editors->File Association
  2. Select *.fxml in the "File types:" list on the right hand side
  3. Click the "Add..." button for the "Associated editors:" list.
  4. Click the "External programs" in the "Editor Selection" menu.
  5. Click the "External programs" radio button.
  6. Click the "Browse..." button and Navigate to this path: "C:\Program Files (x86)\Oracle\JavaFX Scene Builder 2.0". Select the file: JavaFX Scene Builder 2.0.exe
  7. Click the "Open" button.
  1. 点击菜单路径:Window->Preferences->General->Editors->File Association
  2. 在右侧的“文件类型:”列表中选择 *.fxml
  3. 单击“相关编辑器:”列表的“添加...”按钮。
  4. 单击“编辑器选择”菜单中的“外部程序”。
  5. 单击“外部程序”单选按钮。
  6. 单击“浏览...”按钮并导航到此路径:“C:\Program Files (x86)\Oracle\JavaFX Scene Builder 2.0”。选择文件:JavaFX Scene Builder 2.0.exe
  7. 单击“打开”按钮。

In the Editor Selection window select the "OK" button.

在编辑器选择窗口中选择“确定”按钮。

In the Associated editors:list, select "JavaFX Scene Builder 2.0" and click the "Default" button.

Associated editors:列表中,选择“JavaFX Scene Builder 2.0”并单击“Default”按钮。

Now you should be good to go!

现在你应该可以走了!

回答by Ashraf Sarhan

Set the SceneBuilder executable path in the JavaFX of your Eclipse IDE as the following:

在 Eclipse IDE 的 JavaFX 中设置 SceneBuilder 可执行路径,如下所示:

  1. Window -> Preferences -> JavaFX
  2. Click "Browse" and navigate to the JavaFXSceneBuilder2.0 bash file (linux) or JavaFXSceneBuilder2.0.exe (windows) like the following:

    Windows: C:\Program Files (x86)\Oracle\JavaFX Scene Builder 2.0

    Linux: /opt/JavaFXSceneBuilder2.0/JavaFXSceneBuilder2.0

  1. 窗口 -> 首选项 -> JavaFX
  2. 单击“浏览”并导航到 JavaFXSceneBuilder2.0 bash 文件 (linux) 或 JavaFXSceneBuilder2.0.exe (windows),如下所示:

    视窗: C:\Program Files (x86)\Oracle\JavaFX Scene Builder 2.0

    Linux: /opt/JavaFXSceneBuilder2.0/JavaFXSceneBuilder2.0

回答by Glavin001

  1. I downloaded SceneBuilder 8.0 from http://gluonhq.com/products/downloads/because Oracle only provides the source code.

  2. Configure Eclipse to use SceneBuilder executable. Go to Preferences -> JavaFX -> set SceneBuilder executable. Mine was C:\Users\USERNAME\AppData\Local\SceneBuilder\SceneBuilder.exe

  1. 我从http://gluonhq.com/products/downloads/下载了 SceneBuilder 8.0,因为Oracle 只提供源代码

  2. 配置 Eclipse 以使用 SceneBuilder 可执行文件。转到首选项 -> JavaFX -> 设置 SceneBuilder 可执行文件。我的是C:\Users\USERNAME\AppData\Local\SceneBuilder\SceneBuilder.exe

回答by Andras Balázs Lajtha

Java FX Scene Builder is not part of the Java SDK nor the e(fx)clipse plugin. It's an external tool that you have to download and install separatly. Java FX Scene Builderis part of the Java Archive, if link doesn't work, you'll probably find a link to the Archive at the bottom of the Java Downloadpage, and find it from there.

Java FX Scene Builder 不是 Java SDK 的一部分,也不是 e(fx)clipse 插件的一部分。它是一个外部工具,您必须单独下载和安装。Java FX Scene BuilderJava Archive 的一部分,如果链接不起作用,您可能会在Java 下载页面底部找到指向 Archive 的链接,然后从那里找到它。

After installation, the cleanest way is to set the path under Window > Preferences > JavaFX

安装后,最干净的方法是在Window > Preferences > JavaFX下设置路径

(on Windows, browse and select C:\Program Files (x86)\Oracle\JavaFX Scene Builder 2.0\JavaFX Scene Builder 2.0.exe as executable).

(在 Windows 上,浏览并选择 C:\Program Files (x86)\Oracle\JavaFX Scene Builder 2.0\JavaFX Scene Builder 2.0.exe 作为可执行文件)。

This will render the context menu option "Open with SceneBuilder" operational on *.fxml files.

这将使上下文菜单选项“使用 SceneBuilder 打开”在 *.fxml 文件上运行。

Unfortunately this doesn't add SceneBuilder as an internal editor or external program, so if you want the file associations, you'll still have to browse for your external program int the file association dialog under Window > Preferences > General > Editors > File Associations. You can choose *.fxml, and add an associated editor, choosing "External programs" and browsing for the above mentionned executable.

不幸的是,这不会将 SceneBuilder 添加为内部编辑器或外部程序,因此如果您想要文件关联,您仍然需要在 Window > Preferences > General > Editors > File Associations 下的文件关联对话框中浏览外部程序. 您可以选择*.fxml,并添加一个关联的编辑器,选择“外部程序”并浏览上面提到的可执行文件。

回答by Utsav Jha

Try downloading javafx scene builder from the link:

尝试从链接下载 javafx 场景生成器:

http://www.oracle.com/technetwork/java/javafxscenebuilder-1x-archive-2199384.html

http://www.oracle.com/technetwork/java/javafxscenebuilder-1x-archive-2199384.html

Then integrate it with your ide by Window>preferences and add a file adssociation as an external program to it.

然后通过 Window>preferences 将它与您的 ide 集成,并向其添加一个文件 adsociation 作为外部程序。

回答by Olawoye Omotayo

set the path to SceneBuilder app; to do this on mac os

设置 SceneBuilder 应用程序的路径;在 mac os 上执行此操作

  1. go to eclipse in your menu bar and click on preferences or press the keyboard shortcut "cmd" + ",".
  2. then click on JavaFX
  3. click on browse to select the path to sceneBuilder executable (which should be in your application folder if you are running mac os.
  1. 转到菜单栏中的 eclipse 并单击首选项或按键盘快捷键“cmd”+“,”。
  2. 然后点击 JavaFX
  3. 单击浏览以选择sceneBuilder可执行文件的路径(如果您运行的是mac os,它应该在您的应用程序文件夹中。

回答by c0der

None of the previous answers solve the described problem for me.
This answerdid.

以前的答案都没有为我解决所描述的问题。
这个答案做到了。

回答by Sadi Mahmud

Those of you who are using MacOS ( in my case ), Go to JavaFx from preferences then browse to application folder and select scene builder.

那些使用 MacOS 的人(在我的情况下),从首选项转到 JavaFx,然后浏览到应用程序文件夹并选择场景构建器。

Doing other ways wont open the exact file you are trying to edit (It may make a new file which will be untitled and you have to save it manually on the project directory). Also right clicking the fxml file, you wont be able to use the option (open with scenebuilder).

执行其他方式不会打开您尝试编辑的确切文件(它可能会创建一个无标题的新文件,您必须手动将其保存在项目目录中)。同样右键单击 fxml 文件,您将无法使用该选项(使用场景构建器打开)。

回答by user2367924

I was getting the same error: SceneBuilderError

我遇到了同样的错误: 场景构建器错误

The way I solved it is by me going to (on Mac) Eclipse/Preferences/JavaFX JavaFX PreferencesSceneBuilder executable, click on "Browse" then select the application SceneBuilder. that should fix it. Apply and close. Now try it again and it should open it up. Hope this helps.

我解决它的方法是我去(在 Mac 上)Eclipse/Preferences/JavaFX JavaFX 首选项SceneBuilder 可执行文件,单击“浏览”然后选择应用程序 SceneBuilder。那应该解决它。应用并关闭。现在再试一次,它应该打开它。希望这可以帮助。