JavaFX FXML API 版本警告
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35210120/
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
JavaFX FXML API version warning
提问by Itai
I have recently started noticing the following warning when starting my JavaFX application:
我最近在启动 JavaFX 应用程序时开始注意到以下警告:
WARNING: Loading FXML document with JavaFX API of version 8.0.65 by JavaFX runtime of version 8.0.60
警告:通过 8.0.60 版的 JavaFX 运行时使用 8.0.65 版的 JavaFX API 加载 FXML 文档
The FXML in question was created by Gluon Scene Builder 8.1.0, running with it's bundled Java, version 1.8.0_65. The application is launched with my OS Java, version 1.8.0_72.
有问题的 FXML 是由 Gluon Scene Builder 8.1.0 创建的,与它捆绑的 Java 版本 1.8.0_65 一起运行。该应用程序使用我的 OS Java 版本 1.8.0_72 启动。
The root node of the FXML does have the attribute
FXML 的根节点确实有属性
xmlns="http://javafx.com/javafx/8.0.65"
but I figured 1.8.0_72 > 1.8.0_65, so why am I getting this message? Is it something I should be worried about? And is there a way to ask the jre what is the JavaFX API version (which, apparently, is not the same as the Java version)?
但我认为 1.8.0_72 > 1.8.0_65,为什么我会收到这条消息?这是我应该担心的事情吗?有没有办法询问 jre 什么是 JavaFX API 版本(显然,它与 Java 版本不同)?
Edit:
Running the code James_D suggested gives the following results:
编辑:
运行 James_D 建议的代码给出以下结果:
java version: 1.8.0_72-internal
javafx.version: 8.0.60
java 版本:1.8.0_72-内部
javafx.version:8.0.60
So, looks like the JavaFX version in the JDK is wrong? Or maybe I have an old jfxrt.jar? I'll look into that.
那么,看起来 JDK 中的 JavaFX 版本是错误的?或者我有一个旧的 jfxrt.jar?我会调查一下。
回答by Shekhar Rai
I think your JDK
version is 1.8.0_60
and JRE
version is 1.8.0_65
.
我认为你的JDK
版本是1.8.0_60
,JRE
版本是1.8.0_65
.
So you should use the same version for both of them.
所以你应该对它们使用相同的版本。
You can check your current JDK
and JRE
versions on your command promptrespectively,
您可以分别在命令提示符下检查当前JDK
和JRE
版本,
java -version
javac -version
or you can go through the System properties using following java code,
或者您可以使用以下java 代码浏览系统属性,
System.out.println(System.getProperties());
回答by Sergey
I had the same issue on Linux with Intellij IDEA. I have solved it by installing the latest Oracle JDK, and providing its path in IDEA's "Project Sturucture" settings menu:
我在使用 Intellij IDEA 的 Linux 上遇到了同样的问题。我通过安装最新的 Oracle JDK解决了这个问题,并在 IDEA 的“项目结构”设置菜单中提供了它的路径:
File/Project Sturucture/Platform Settings/SDKs
文件/项目结构/平台设置/SDK
回答by sproketboy
If you use the form:
如果您使用表格:
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
The versioning is ignored. You'd only need it if you had some compatibility issue with another version.
版本控制被忽略。只有当您与另一个版本存在兼容性问题时才需要它。
回答by Saidar Ramazanov
I have that problem also. I managed it just to change lines in *.fxml files:
我也有这个问题。我管理它只是为了更改 *.fxml 文件中的行:
javafx/8.0.171 -> javafx/8.0.141
javafx/8.0.171 -> javafx/8.0.141
Previously it was like this, it is a line in the begining of fxml file:
以前是这样的,它是fxml文件开头的一行:
<AnchorPane prefHeight="300.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.application.word.view.LoginController">
Then I changed it for:
然后我将其更改为:
<AnchorPane prefHeight="300.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.application.word.view.LoginController">
And it works without any problem. But be carefull that it can be different if you use different jdk generations.
它可以毫无问题地工作。但是请注意,如果您使用不同的 jdk 代,它可能会有所不同。
回答by Adam Soko?owski
I had same issue. Dunno what IDE you guys are running, but I fixed it on Eclipse.
我有同样的问题。不知道你们在运行什么 IDE,但我在 Eclipse 上修复了它。
Inside project exploreron right side of JRE System Libraryit was showing [J2SE-1.5]. I right clicked JRE System Library, went in Properties. Switched from Execution Environementto Workspace default environement.
在JRE 系统库右侧的项目浏览器中,它显示[J2SE-1.5]。我右键单击JRE System Library,进入Properties。从执行环境切换到工作区默认环境。
If inside workspace default environementbrackets it does not show your newest jdk version eg. (jdk1.8.0_192)your can change it by picking Installed JREsbutton and switching checked JRE.
如果在工作区默认环境括号内,它不会显示您最新的 jdk 版本,例如。(jdk1.8.0_192)您可以通过选择已安装的 JRE按钮并切换选中的 JRE来更改它。
If your jdk is not listed add it with ADDbutton and pick your JDK directory eg. C:\Program Files\Java\jdk1.8.0_192, as home directory.
如果未列出您的 jdk,请使用ADD按钮添加它并选择您的 JDK 目录,例如。C:\Program Files\Java\jdk1.8.0_192,作为主目录。
In case, for some reason, you don't want to change your default environement just pick Alternate JREinstead of Workspace default JRE. Then pick right SDK from dropdown menu.
如果出于某种原因,您不想更改默认环境,只需选择Alternate JRE而不是Workspace default JRE。然后从下拉菜单中选择正确的 SDK。
PS. Yes you can change version under xmlns option inside your fxml file, but you will have to update entry every time you modify your fxml inside Scene Builder.
附注。是的,您可以在 fxml 文件中的 xmlns 选项下更改版本,但是每次在 Scene Builder 中修改 fxml 时都必须更新条目。
回答by Nosakhare George Ohonba
I had same issues but I solved it by going through this steps
我有同样的问题,但我通过这些步骤解决了它
If you are using Intellij IDEA goto File -> Project Structure -> SDKsand click on the (-) signto remove all other JDK you have before then click on the (+) signto add the new JDK to the project from you C:\Program Files (x86)\Java\jdk1.8.0_172.
如果您使用 Intellij IDEA,请转到File -> Project Structure -> SDKs并单击(-) 符号以删除您之前拥有的所有其他 JDK,然后单击(+) 符号将新的 JDK 添加到您的项目中C :\Program Files (x86)\Java\jdk1.8.0_172。
回答by Reza
Same was for me. as you mentioned your scene builder version is 8.1.0 while your Javafx version is 8.0.60. well they're different:) two way to fix this
对我来说也是如此。正如您提到的,您的场景构建器版本是 8.1.0,而您的 Javafx 版本是 8.0.60。好吧,它们是不同的:) 解决此问题的两种方法
- uninstall current scene builder and install the one with same version of your Javafx
- every time you edit a FXML file using scene builder, change xmlns property in your header to your Javafx version
- 卸载当前的场景构建器并安装与您的 Javafx 版本相同的场景构建器
- 每次使用场景构建器编辑 FXML 文件时,将标题中的 xmlns 属性更改为 Javafx 版本
for example my javafx version is 9.0.1 while I use scene builder 10.0.1 but after editing in scene builder I change
例如,我的 javafx 版本是 9.0.1,而我使用场景生成器 10.0.1 但在场景生成器中编辑后我改变了
xmlns="http://javafx.com/javafx/9.0.1"
to
到
xmlns="http://javafx.com/javafx/9.0.1"
for may own sake :)
为了自己的缘故:)
回答by ARY
I was also having samme problem will i was loading my fxml file
WARNING: Loading FXML document with JavaFX API of version 8.0.171 by JavaFX runtime of version 8.0.111
then i went to oracle website and update the jre till 171 update of java 8.0
我也遇到了同样的问题,我是否正在加载我的 fxml 文件警告:通过 8.0.111 版的 JavaFX 运行时使用 8.0.171 版的 JavaFX API 加载 FXML 文档然后我去了 oracle 网站并更新 jre 直到 java 8.0 的 171 更新