1

End goal: On Ubuntu 18.04 LTS, develop javafx application using jdk11 LTS using the eclipse IDE.

Problem: Eclipse seems to not understand what jdk11 is. It doesn't recognize built-in libraries, and of course javafx as well.

Ubuntu is installed and to my knowledge working correctly.

java -version:

java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

javafx: https://gluonhq.com/products/javafx/

Eclipse 4.11 (2019-03) is installed and runs fine otherwise. I was using jdk8, with no javafx applications.

I've tried following multiple tutorials online... but I'm tearing my hair. It's very frustrating.

Thanks for your time~

2
  • Are you trying to reuse a workspace you used with a previous Java/Eclipse version?
    – xenoid
    Commented May 13, 2019 at 22:33
  • @xenoid No. I created a new workspace to use for jdk11.
    – Jon
    Commented May 13, 2019 at 22:47

3 Answers 3

0

In Eclipse 2019-03 (4.11.0) the default Java version is setting by going to Window -> Preferences -> Installed JREs -> select the name and location of the installed JRE as shown in the below screenshot.

Installed JREs
Eclipse 2019-03 (4.11.0) in Ubuntu 18.04

In the Ubuntu 16.04 and later default repositories JavaFX is packaged as a separate package named openjfx. To install it in Ubuntu 18.04, open the terminal and type:

sudo apt install openjdk-11-jdk openjfx

Optionally you can install openjdk-8-jdk instead of or alongside openjdk-11-jdk. openjfx works with both openjdk-8-jdk and openjdk-11-jdk in Eclipse in Ubuntu 18.04.

2
  • My thanks for your answer! I've configured my module path with the correct jdk11, and javafx11. A basic javafx application compiles, but doesn't run. It spits out this error: bash Error: Could not find or load main class javac Caused by: java.lang.ClassNotFoundException: javac
    – Jon
    Commented May 14, 2019 at 7:23
  • 1
    Reference to stackoverflow post.
    – Jon
    Commented May 14, 2019 at 7:44
1

I'll detail my install and setup process in case anyone else has troubles:

Setup for javafx11, jdk11, and Eclipse on Ubuntu 18.04

Install openjdk11 and javafx11 SDK

sudo apt install openjdk-11-jdk openjfx

Be sure to select the SDK version of javafx!

javafx

Check java Version Reads Out the Correct jdk Version

java -version

The output should look like this:

openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.04.1)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.04.1, mixed mode, sharing)

Install the Newest Eclipse 2019-03 (4.11)

Download link

When creating a project:

  1. Create a new java project
    • Be sure the jdk used for the project is jdk11
    • Don't create module.info
  2. Right click your project folder and click "Properties". Go to the "Libraries" Tab and left click "Module Path". On the right, select "Add Library" and choose "User Library"
    • name it javafx
    • include all of the .jar files in /path/to/javafx/lib
      • Don't include anyother file type!
  3. Add the newely created libary to the projects module path
  4. In run configuration, found in the run taskbar, select the "Arguments" tab and add this to VM arguments:
    • --module-path /usr/lib/jvm/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml
    • Be sure the path to your javafx is correct!
0

https://bugs.launchpad.net/ubuntu/+source/openjfx/+bug/1825054

jfx does not work anymore under ubuntu ... waiting for a fix since a long time (either with jdk 8 or 11)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .