如何在 Eclipse 中使用 JavaFX 2 SDK?
我已经安装了 JavaFX 2.0 SDK,现在我想使用 Eclipse 制作一个 JavaFX 应用程序。但是如何在 Eclipse 中使用 javafx.*
类呢?
官方 JavaFX Eclipse 插件 似乎适用于 JavaFx 1.2 并且已经过时。
当我尝试安装 e(fx)clipse 插件 时,出现以下错误:
Cannot complete the install because one or more required items could not be found.
Software being installed: efxclipse 0.0.8.201111131640 (at.bestsolution.efxclipse.feature.feature.group 0.0.8.201111131640)
Missing requirement: Eclipse DI integration for JavaFX 0.0.8.201111131640 (at.bestsolution.efxclipse.runtime.di 0.0.8.201111131640) requires 'bundle org.eclipse.e4.core.contexts 0.9.0' but it could not be found
Cannot satisfy dependency:
From: efxclipse 0.0.8.201111131640 (at.bestsolution.efxclipse.feature.feature.group 0.0.8.201111131640)
To: at.bestsolution.efxclipse.runtime.feature.feature.group [0.0.8.201111131640]
Cannot satisfy dependency:
From: FX Runtime 0.0.8.201111131640 (at.bestsolution.efxclipse.runtime.feature.feature.group 0.0.8.201111131640)
To: at.bestsolution.efxclipse.runtime.di [0.0.8.201111131640]
I have installed JavaFX 2.0 SDK and now I would like to do an JavaFX application with Eclipse. But how can I use the javafx.*
classes in Eclipse?
The official JavaFX Eclipse plugin seem to be for JavaFx 1.2 and outdated.
When I try to install e(fx)clipse plugin, I get this error:
Cannot complete the install because one or more required items could not be found.
Software being installed: efxclipse 0.0.8.201111131640 (at.bestsolution.efxclipse.feature.feature.group 0.0.8.201111131640)
Missing requirement: Eclipse DI integration for JavaFX 0.0.8.201111131640 (at.bestsolution.efxclipse.runtime.di 0.0.8.201111131640) requires 'bundle org.eclipse.e4.core.contexts 0.9.0' but it could not be found
Cannot satisfy dependency:
From: efxclipse 0.0.8.201111131640 (at.bestsolution.efxclipse.feature.feature.group 0.0.8.201111131640)
To: at.bestsolution.efxclipse.runtime.feature.feature.group [0.0.8.201111131640]
Cannot satisfy dependency:
From: FX Runtime 0.0.8.201111131640 (at.bestsolution.efxclipse.runtime.feature.feature.group 0.0.8.201111131640)
To: at.bestsolution.efxclipse.runtime.di [0.0.8.201111131640]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我安装了 Eclipse Neon.1 (4.6.1)
然后帮助=>日食市场
在查找时指定“javaFX”并安装“e(fx)clise 2.4.0”
I installed Eclipse Neon.1 (4.6.1)
Then Help => Eclipse Marketplace
On find specify "javaFX" and install "e(fx)clise 2.4.0"
有两个选项:
1) 编辑:自 7u35(或附近的某个版本)起,JavaFX 已包含在基本 JDK 类路径中,因此您可以立即使用 JavaFX 类。
只需将您的项目设置为使用 fx 库即可:JavaFX 2.0 API 是纯 Java。因此,您可以创建一个新的 Java 项目并将 sdk-path/rt/lib/jfxrt.jar 添加到库中以在该项目中使用 JavaFX。
对于 JDK7 中的联合构建,路径将是下一个jdk-path/jre/lib/jfxrt.jar
2) 使用 e(fx)clipse 插件:http://www.eclipse.org/efxclipse/index.html
There are two options:
1) EDIT: Since 7u35 (or smth near it) JavaFX was included into base JDK classpath so you can use JavaFX classes right away.
Just set up your projects to use fx libs:JavaFX 2.0 API is pure Java. So you can create a new Java project and add
sdk-path/rt/lib/jfxrt.jar
to libraries to use JavaFX in that project.For cobundled builds in JDK7 path would be nextjdk-path/jre/lib/jfxrt.jar
2) Use e(fx)clipse plugin: http://www.eclipse.org/efxclipse/index.html
您可以使用 e(fx)clipse!您可以在这里找到它:http://www.eclipse.org/efxclipse/index.html
下载后,您必须使用 JavaFX SDK(必须安装)配置 IDE。
您所需要做的就是打开“窗口”>“首选项> JavaFX 并配置 JavaFX-SDK 的位置。
您通常将其放在“程序文件”>“甲骨文。
希望这会对您有所帮助!
You can use e(fx)clipse! You can find it here: http://www.eclipse.org/efxclipse/index.html
After download you must to configure the IDE with your JavaFX SDK(must be installed).
All you need to do is to open Window > Preferences > JavaFX and configure the location of your JavaFX-SDK.
You ussualy have it in Program Files > Oracle.
Hope this will help you!
基于 Sergey Grinev 解决方案,我注意到我们可以为所有 java 项目定义一次。
这样,您的所有java项目都基于这个JVM版本可以支持JavaFx甚至您的旧项目(选择每个项目构建路径并最终用您刚刚编辑的jvm替换旧jvm)
Based on Sergey Grinev solution, I noticed that we can define this once for all java projects.
This way, all your java projects based on this JVM version can support JavaFx and even your older projects (Select each project build path and eventually replace the old jvm with the jvm that you've just edited)
要使用 Eclipse Luna (4.4) 访问 Java8 中的 JavaFx:
转到“构建路径/JRE/访问规则/编辑/添加/可访问:javafx/**”
这似乎比手动编辑类路径文件或(再次)将 JAR 添加到构建路径。
To access JavaFx in Java8 with Eclipse Luna (4.4):
Go to Build Path/ JRE/ Access rules/ Edit/ Add/ Accessible: javafx/**
This seems better than editing the classpath file manually or adding the JAR (again) to the build path.
顺便说一句,它说它不会安装 FX 插件,因为您缺少 org.eclipse.e4.core.contexts 包。您是否尝试将其安装到 Eclipse Indigo 或 3.8 中?或者您在开始之前是否按照网站上的说明下载了 eclipse 4.2?
As an aside, it says it won't install the FX plugin because you are missing
org.eclipse.e4.core.contexts
bundle. Were you trying to install it into Eclipse Indigo, or 3.8? Or did you follow the instructions on the website and download eclipse 4.2 before you started?如果您不介意使用 java 8,那么您就不必经历任何麻烦。只需将其设置为默认的 jre 和 javafx 导入即可开箱即用。
If you don't mind working with java 8, you won't have to jump through any hoola hoops. Just set that as your default jre and javafx imports work out of the box.
要将 e(fx)clipse 工具安装到现有的 Eclipse 中,您必须添加更新站点。
尚未发布,因此您需要添加夜间更新站点 http://download。 eclipse.org/efxclipse/updates-nightly/site
To install the e(fx)clipse tooling into your already existing Eclipse you have to add an Update site.
There's no released yet available so you need to add the nightly update-site http://download.eclipse.org/efxclipse/updates-nightly/site