JavaFX FXML API version warning

99封情书 提交于 2019-12-17 11:42:05

问题


I have recently started noticing the following warning when starting my JavaFX application:

WARNING: Loading FXML document with JavaFX API of version 8.0.65 by JavaFX runtime of version 8.0.60

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.

The root node of the FXML does have the attribute

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)?

Edit:
Running the code James_D suggested gives the following results:

java version: 1.8.0_72-internal
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.


回答1:


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.




回答2:


I think your JDK version is 1.8.0_60 and JRE version is 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 prompt respectively,

java -version
javac -version

or you can go through the System properties using following java code,

System.out.println(System.getProperties());



回答3:


I have that problem also. I managed it just to change lines in *.fxml files:

javafx/8.0.171 -> javafx/8.0.141

Previously it was like this, it is a line in the begining of fxml file:

<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.




回答4:


I had same issue. Dunno what IDE you guys are running, but I fixed it on Eclipse.

Inside project explorer on right side of JRE System Library it was showing [J2SE-1.5]. I right clicked JRE System Library, went in Properties. Switched from Execution Environement to Workspace default environement.

If inside workspace default environement brackets it does not show your newest jdk version eg. (jdk1.8.0_192) your can change it by picking Installed JREs button and switching checked JRE.

If your jdk is not listed add it with ADD button and pick your JDK directory eg. C:\Program Files\Java\jdk1.8.0_192, as home directory.

In case, for some reason, you don't want to change your default environement just pick Alternate JRE instead of Workspace default JRE. Then pick right SDK from dropdown menu.

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.




回答5:


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




回答6:


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:

File/Project Sturucture/Platform Settings/SDKs




回答7:


I had same issues but I solved it by going through this steps

If you are using Intellij IDEA goto File -> Project Structure -> SDKs and click on the (-) sign to remove all other JDK you have before then click on the (+) sign to add the new JDK to the project from you C:\Program Files (x86)\Java\jdk1.8.0_172.




回答8:


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

  • 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

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

xmlns="http://javafx.com/javafx/9.0.1"

to

xmlns="http://javafx.com/javafx/9.0.1"

for may own sake :)



来源:https://stackoverflow.com/questions/35210120/javafx-fxml-api-version-warning

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!