JavaFX FXML API version warning

2019-01-18 18:16发布

问题:

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 the JRE version is 1.8.0_65.

So you should download the same version of JDK and JRE.

You can check your current java version from your command prompt,

java -version

or you can go through the System properties using the 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 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



回答5:

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.



标签: java javafx fxml