4

I'm actually trying to follow a JavaFX tutorial and when i got my Main app running to have an preview it shows me this Warning on console :

Feb 24, 2017 12:55:20 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 8.0.111 by JavaFX runtime of version 8.0.60
Feb 24, 2017 12:55:20 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 8.0.111 by JavaFX runtime of version 8.0.60

i searched a bit and it seems i have different versions of JDK/JRE or something like that, here is the output from this code i found on this topic :

System.out.println("java version: "+System.getProperty("java.version"));
System.out.println("javafx.version: " + System.getProperty("javafx.version"));

OUTPUT :
java version: 1.8.0_121
javafx.version: 8.0.60

OUTPUT from java -version command :

openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

i went to this location : /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java and found 2 folders "java-1.8.0-openjdk-amd64" and "java-8-openjdk-amd64" (both have the same size) so maybe these are the 2 versions confliction? what should i do to resolve the problem?

The "alternative" command doesn't work for me, it shows me this error:

No command 'alternatives' found, did you mean:
Command 'galternatives' from package 'galternatives' (universe)
alternatives: command not found

i downloaded the galternative app but when i run it i don't find multiple choices on any "java" related alternative...

EDIT : after searching a bit i found about this command (sudo update-alternatives --config java) and used it and here is the OUTPUT from it :

There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Nothing to configure.

so i guess it's safe to assume that this is not a problem of alternative installations of java...

SOLUTION : i actually made it by Uninstalling openjdk-8 and installing oracle Java-8
1) Uninstalling openjdk-8 on ubuntu-based distributions using this command :
sudo apt-get purge openjdk-8-* (here is a more general tutorial to uninstall Java in general http://www.2daygeek.com/remove-uninstall-oracle-java-openjdk-on-ubuntu-centos-debian-fedora-mint-rhel-opensuse/)

2) Installing Oracle Java-8 using this command :

sudo apt-get install oracle-java8-set-default

or following this tutorial (http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html)

Community
  • 1
  • 1
user7616817
  • 357
  • 4
  • 18
  • Possible duplicate of [JavaFX FXML API version warning](http://stackoverflow.com/questions/35210120/javafx-fxml-api-version-warning) – Itai Feb 24 '17 at 13:59
  • It is possible that your distribution haven't updated the `openjfx` package, or maybe you haven't installed the latest version. If you are using the latest openjfx package, the simplest solution would be to switch to Oracle's JRE, which is complete (i.e. - JavaFX isn't packaged separately) – Itai Feb 24 '17 at 14:01
  • well i'll download it from this link (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) but how can i uninstall the one i'm using rightnow before installing the new one so that i won't have conflicting version problems? – user7616817 Feb 24 '17 at 18:14
  • NEVERMIND, i just had to go to the eclipse.ini and set the right path of my new java installation under the -vm line (/usr/lib/jvm/java-8-oracle/jre/bin) and it works, i tried to run my JavaFx app and i don't get that error Anymore, i'll update my first post and mark this one as solved, thank you for your help :) – user7616817 Feb 24 '17 at 19:33
  • of course i appreciated your help (sorry, this is my first post on this forum and i'm not familiar with the vote system yet ) – user7616817 Feb 24 '17 at 19:45
  • No problem. Just for the record: now you upvoted (great). But in order to "solve", you also want to click that "check mark" icon next to the voting errors of my answer ;-) ... and the one other thing: you might want to go over your comments; and decide which ones of them to delete - in order to make questions helpful for future users, it is actually better to get **rid** of those too many side discussion comments. – GhostCat Feb 24 '17 at 19:47
  • Now you got it ;-) Thank you very much! – GhostCat Feb 24 '17 at 19:49
  • You're welcome ! :) all right i'll clean up some comments since i already posted all what i did in order to resolve the problem in the first post. – user7616817 Feb 24 '17 at 19:56

1 Answers1

1

In the end, this question here is about a mismatch of JavaFx runtime files and the JRE/JDK installed on the local system.

Especially with Linux, those two often come via "different" paths. The OpenJDK is installed via the distribution package management system; and not working with the JavaFx libraries/tooling.

In order to overcome such potential problems, the "easiest" approach is to use the "original" JDK from Oracle. This can be even "tried" without doing a full install that alters the system: simply by download the JDK as archive from Oracle and by extracting it locally.

GhostCat
  • 137,827
  • 25
  • 176
  • 248
  • In the end, you have more of a "how to install/work with my ubuntu" problem. I would recommend you to put up a question on askubuntu.com (like "how do I determine which Java I am using" or something similar. But the thing is: if you dont have alternatives installed, then chances are that you have links in /usr/bin that *directly* go to the place where the real binaries. And beyond that - it is your system; shouldnt you know when/how you installed your java versions? (java needs to be installed on ubuntu, it is not part of the initial install methinks) – GhostCat Feb 24 '17 at 17:52
  • Edit : i found this command "sudo update-alternatives --config java" and here is the OUTPUT from it : There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java Nothing to configure. so there is actually no alternative java version installed on my system – user7616817 Feb 24 '17 at 18:32