1

EDIT: the tutorial linked in the answer of the duplicated question has gotten me past the problem I wrote about here. I had seen that question earlier and I did not, at the time, think it applied. But I was mistaken and I don't know how to account for the mistake. To install a working copy of a modular OpenJDK and JavaFX, I agree that the "Getting started" tutorial at http://openjfx.io is an appropriate resource. /EDIT


I have relatively simple source code that I would like to compile on Ubuntu. The code was developed in Eclipse/Windows, and makes use of JavaFX. My hope was to simply copy over the text source and do a modular compile, with the end goal being to make a self-contained program using jlink for Linux installation. The code is simple enough that the command line commands javac (with the modules option) and jlink are quite sufficient.

I installed OpenJDK 10, figuring that would be fine, as it contains the jlink utility and supports modular programming.

> java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

I'm able to run Java jars with it, but NOT if they require JavaFX.

> java -jar rnk.jar
Error: Could not find or load main class com.adonax.keyboard.LaunchKeyboard8
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

First attempt to deal with this, I installed OpenJFX with the following command:

sudo apt-get install OpenJFX

AFAIK, it installed fine, but I could not find instructions for testing or verifying the install on any of the Ask Ubuntu or StackOverflow posts that recommend this install. Attempting to run a jar which includes JavaFX code still fails, with the same error.

Using OpenJDK 8 is not a solution. The goal is to be able to use the command line javac and jlink, and Java 8 does not support modules.

I was trying to avoid using Oracle's Java 9 or 10, as suggested in many of the answers I've researched, because as far as I know, Oracle is requiring a license payment

I'm admittedly weak in terms of my Linux & Ubuntu knowledge, and have gotten myself totally confused on how to go forward. Ramping up to the expertise required to build as in this article would be a big leap.

I am hoping that these last few lines justifies my question not be marked a "duplicate question."

Is there something simpler that I've overlooked?

  • openjdk-11-jdk works with openjfx in Netbeans 8.2 in Ubuntu 18.04. If you upload your rnk.jar and java source code to a pastebin website and provide a link to it in a comment, I will test if I can get your original Windows Java code working in Ubuntu 18.04. – karel Jan 02 '19 at 08:23
  • Thanks George. The link you posted connects to https://openjfx.io/ which looks like it provides considerable documentation. I will give this a good look-over. – Phil Freihofner Jan 02 '19 at 08:36
  • Hi karel, I see from your link and earlier response that NetBeans can be configured to run both OpenJDK 11 and OpenJFX. I'll give that a look. If I go the route of installing Netbeans and have trouble getting the program to run, I'll try to pinging again. Have you built module-based self-contained java apps for Linux distribution? Am also going to take a look at a new Eclipse offering (https://www.eclipse.org/openj9/). – Phil Freihofner Jan 02 '19 at 08:45
  • 1
    Yes, was able to load OpenJDK 11 and OpenJFX together and run the sample program via the "Getting Started" tutorial at http://openjfx.io. This answers my question. – Phil Freihofner Jan 03 '19 at 07:52

0 Answers0