0
votes

I have attempted to follow this solution, Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)?, but is is unfortunately outdated. I did find the package openjfx I think I need here: https://launchpad.net/~tj/+archive/ubuntu/java-for-14.04

The package installs fine, under /usr/lib/jvm/java-8-openjdk-amd64/jre/lib and I can find jfxswt.jar and jfxrt.jar under the ext folder. The problem is that the java compiler does not know that they are here. I've tried explicitly pointing to their locations through the javac -cp and declaring the classpath in .bashrc. In both situations I declared them as such: ".:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfxswt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar"

Upon compilation: javac -cp ".:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfxswt.jar:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar" EventsDemo.java

Terminal Output:

EventsDemo.java:1: error: package javafx.application does not exist import javafx.application.Application;

So in short, I think I have done something wrong with the classpath and I would like to know how to get my compiler to recognize JavaFX. I hope I have provided enough information. I would prefer a solution not requiring the use of an IDE as I am trying to understand how to compiler handles these things. Thanks!

1
Wily is an experimental/developement version of ubuntu or rather was: now dated, the developement branch from 2015. In general dev branches are not supposed to work flawlessly. And additionally you want to use a package for Ubuntu 14 on that unstable 15 branch? This will only work with some luck. Current productive lts version is Ubuntu 18.04kai
I’m sorry if I wasn’t clear, but I am using Ubuntu 18.10. The package for JavaFx is the only thing that is out of date here. The one I downloaded was intended for Java 8 which is what I am currently using. So I assume there is compatibility, but my so far I haven’t been able to get my class path to recognize that JavaFX is installed.WestPatriot
in that case i'd use the jfx that comes with it: packages.ubuntu.com/bionic/openjfx so remove the manual added stuff and just do apt-get install openjfxkai

1 Answers

0
votes

So, I did end up finding the answer, I should not have used openjdk-8. Perhaps I could have, but the better way I found was to download the version of Java 8u201 from Oracle's website.

https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

This version contains the proper version of JavaFX and I simply pointed to this install using .bashrc and JavaFX works without any classpath issues, as it should.