简体   繁体   English

打开场景构建器时出错

[英]Error opening scene builder

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

Set the SceneBuilder executable path in the JavaFX of your Eclipse IDE as the following:在 Eclipse IDE 的 JavaFX 中设置 SceneBuilder 可执行路径,如下所示:

  1. Window -> Preferences -> JavaFX窗口 -> 首选项 -> JavaFX
  2. Click "Browse" and navigate to the JavaFXSceneBuilder2.0 bash file (linux) or JavaFXSceneBuilder2.0.exe (windows) like the following:单击“浏览”并导航到 JavaFXSceneBuilder2.0 bash 文件 (linux) 或 JavaFXSceneBuilder2.0.exe (windows),如下所示:

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

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

Make sure you are running the latest version of Eclipse.确保您运行的是最新版本的 Eclipse。 I've tested this with Luna 4.4 as I had the same issue.我已经用 Luna 4.4 对此进行了测试,因为我遇到了同样的问题。

Install the latest version of JavaFX Scene Builder.安装最新版本的 JavaFX Scene Builder。 You can find version 2.0 here: http://www.oracle.com/technetwork/java/javase/downloads/sb2download-2177776.html您可以在此处找到 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点击菜单路径:Window->Preferences->General->Editors->File Association
  2. Select *.fxml in the "File types:" list on the right hand side在右侧的“文件类型:”列表中选择 *.fxml
  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".单击“浏览...”按钮并导航到此路径:“C:\\Program Files (x86)\\Oracle\\JavaFX Scene Builder 2.0”。 Select the file: JavaFX Scene Builder 2.0.exe选择文件:JavaFX Scene Builder 2.0.exe
  7. Click the "Open" button.单击“打开”按钮。

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!现在你应该可以走了!

  1. I downloaded SceneBuilder 8.0 from http://gluonhq.com/products/downloads/ because Oracle only provides the source code .我从http://gluonhq.com/products/downloads/下载了 SceneBuilder 8.0,因为Oracle 只提供源代码

  2. Configure Eclipse to use SceneBuilder executable.配置 Eclipse 以使用 SceneBuilder 可执行文件。 Go to Preferences -> JavaFX -> set SceneBuilder executable.转到首选项 -> JavaFX -> 设置 SceneBuilder 可执行文件。 Mine was C:\\Users\\USERNAME\\AppData\\Local\\SceneBuilder\\SceneBuilder.exe我的是C:\\Users\\USERNAME\\AppData\\Local\\SceneBuilder\\SceneBuilder.exe

Java FX Scene Builder is not part of the Java SDK nor the e(fx)clipse plugin. Java FX Scene Builder 不是 Java SDK 的一部分,也不是 e(fx)clipse 插件的一部分。 It's an external tool that you have to download and install separatly.它是一个外部工具,您必须单独下载和安装。 Java FX Scene Builder is 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 Download page, and find it from there. 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.不幸的是,这不会将 SceneBuilder 添加为内部编辑器或外部程序,因此如果您想要文件关联,您仍然需要在 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.您可以选择*.fxml,并添加一个关联的编辑器,选择“外部程序”并浏览上面提到的可执行文件。

set the path to SceneBuilder app;设置 SceneBuilder 应用程序的路径; to do this on mac os在 mac os 上执行此操作

  1. go to eclipse in your menu bar and click on preferences or press the keyboard shortcut "cmd" + ",".转到菜单栏中的 eclipse 并单击首选项或按键盘快捷键“cmd”+“,”。
  2. then click on JavaFX然后点击 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.单击浏览以选择sceneBuilder可执行文件的路径(如果您运行的是mac os,它应该在您的应用程序文件夹中。

None of the previous answers solve the described problem for me.以前的答案都没有为我解决所描述的问题。
This answer did.这个答案做到了。

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 作为外部程序。

I was getting the same error:我遇到了同样的错误: 场景构建器错误

The way I solved it is by me going to (on Mac) Eclipse/Preferences/JavaFX我解决它的方法是我去(在 Mac 上)Eclipse/Preferences/JavaFX JavaFX 首选项 SceneBuilder executable, click on "Browse" then select the application SceneBuilder. SceneBuilder 可执行文件,单击“浏览”,然后选择应用程序 SceneBuilder。 that should fix it.那应该解决它。 Apply and close.应用并关闭。 Now try it again and it should open it up.现在再试一次,它应该打开它。 Hope this helps.希望这可以帮助。

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 文件,您将无法使用该选项(使用场景构建器打开)。

This could as easy as you have missed installing the Scene Builder for the JavaFx.这可能就像您错过了为 JavaFx 安装Scene Builder一样简单。 By installing only the JavaFx from the eclipse market is not enough you have to manuall follow that above link of scene builder and download the softare and after installation just check again it will definatelly work now!仅从 eclipse 市场安装 JavaFx 是不够的,您必须手动按照上面的场景构建器链接下载软件,安装后再次检查它现在肯定可以工作!

This thing worked in my Case :)这件事在我的案例中有效:)

For Windows users:对于 Windows 用户:

Although the question is asked 07 years ago, still the problem persists.虽然这个问题是07年前问的,但问题依然存在。 Recently I get the same error in the question.最近我在问题中遇到了同样的错误。 I am a Windows user and I get my error fixed by a combination of methods as follows.我是 Windows 用户,我通过以下方法组合修复了我的错误。 I will explain the steps very simply that could be understood by anybody.我将非常简单地解释任何人都可以理解的步骤。 Because this problem is often faced by newbies to JavaFX and Eclipse IDE.因为这个问题经常是 JavaFX 和 Eclipse IDE 的新手所面临的。

  1. First download and install the JavaFXSceneBuilder.首先下载并安装JavaFXSceneBuilder。 Remember to copy the path where it will be installed.记得复制安装路径。 (mine: C:\\Program Files (x86)\\Oracle\\JavaFX Scene Builder 2.0 ) (我的: C:\\Program Files (x86)\\Oracle\\JavaFX Scene Builder 2.0
    Link: Click here链接: 点击这里
    (Sometimes this link will not work when new updates are released. Then simply google search for 'JavaFXScenBuilder download' . Then download the latest version that suits your OS) (有时在发布新更新时此链接将不起作用。然后只需谷歌搜索“JavaFXScenBuilder 下载” 。然后下载适合您操作系统的最新版本)
  2. Next go to the Menu tab in Eclipse.接下来转到 Eclipse 中的菜单选项卡。
  3. Go to Window -> Preferences转到窗口 -> 首选项
  4. In the search box, Search 'JavaFX' and click on it.在搜索框中,搜索“JavaFX”并单击它。 浏览 JavaFXSceneBuilder
  5. Then, click on the 'Browse' button in front of the 'SceneBuilder executable'.然后,单击“SceneBuilder 可执行文件”前面的“浏览”按钮。
  6. Go to the path initially copied in step 01, and find the 'JavaFX Scene Builder 2.0.exe' file (yours version may be different if install a later version).转到最初在步骤 01 中复制的路径,并找到“JavaFX Scene Builder 2.0.exe”文件(如果安装更高版本,您的版本可能会有所不同)。 选择.exe文件
  7. Select it.选择它。 Then click on 'Apply'.然后点击“应用”。 Next 'Apply and close'.接下来“应用并关闭”。 申请和关闭
  8. Now go back to the .fxml file and try open with 'SceneBuilder'.现在返回 .fxml 文件并尝试使用“SceneBuilder”打开。

Hope this answer may help for the new users of eclipse like me...!希望这个答案可以帮助像我这样的 eclipse 新用户......!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM