javafxefxclipse

e(fx)clipse JavaFX still missing


I am running XUbuntu x64 14.04.4 LTS on my PC, with eclipse Mars.2 Release (4.5.2) and JDK 8 properly linked up to my eclipse (via ini file).

So basically, I "upgradet" to e(fx)clipse. Then I crated a new "JavaFX project". When I tried to run it, I got the error The import javafx.application cannot be resolved.

A quick google search brought up, that I need to add the jfxwt.jar from my java 1.8 directory (in my case /opt/Oracle_Java/jdk1.8.0_91/jre/lib/).

But the error didn't went away. I also tried the build options but nothing seemed to change anything.


Solution

  • First of all, I included the wrong jar. whoops. thanks to @DVarga for the tip.

    But that wasn't the problem. So here are all the steps I took, to create a working e(fx)clipse environment:

    1. Download the latest eclipse version and add the e(fx)clipse package.

    2. Update to the latest JDK and reference that in the eclipse.ini file (1)

    3. Tell ecplipse the path for the latest JDK. Although this tutorial is for MACs, it works pretty much the same in linux. There are a few differences tho:

      1. The preferences menu is in window > preferences

      2. The JRE type is not MacOS X VM but rather Standard VM

      3. The JRE home path is the jdk1.8.0_VERSION folder (in my case /opt/Oracle_Java/jdk1.8.0_91)

    I didn't need to add any other jar for javaFX to work properly.

    (1) How to add the Java 1.8 path to eclipse

    if you get the error "JavaFX was disabled because your java version is to old" (or something like this) you need to update to at least Java 1.8 and edit the eclipse.ini file in the eclipse folder.

    There you have to look for the line -vm. In the next line is a path to an old Java version. Change that to the new path. It should look like this: /path/to/jdk1.8.0_VERSION/jre/bin/ in my case it is /opt/Oracle_Java/jdk1.8.0_91/jre/bin/