Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX missing from JDK 1.7/1.8 in Linux?

I have a problem that allegedly isn't possible, so I'm having a heck of a time finding an answer.

I have the latest version of NetBeans 7.4, running on fully-updated Fedora 20 x64. Officially, this can work with JavaFX. Period. I have both the JDK from the repo (1.7.something) and the very latest version I could find (1.8.0). Officially, these have JavaFX with them. Period.

If I try to create a new JavaFX project, it has this to say:

Failed to automatically set-up a JavaFX Platform. Please go to Platform Manager, create a non-default Java SE platform, then go to the JavaFX tab, enable JavaFX and fill in the paths to valid JavaFX SDK and JavaFX Runtime. Note: JavaFX SDK can be downloaded from JavaFX website.

Well alright, I'm used to things getting confused, I think I can fix this. Go create a new platform, and... there's no "JavaFX" tab. It took a bit of research to even find out what it was talking about, and in the process I discovered that the tab has actually been removed from 7.4. Because NetBeans 7.4 will absolutely, definitely recognize JavaFX automatically. Period.

Going to the actual JavaFX site tells me, as expected, that it's bundled with the Java SE 7 JDK I already have. Period.

Since the end result I'm after could technically be achieved by integrating one JavaFX component into my Swing application, I attempted that, but NetBeans still can not find anything related to JavaFX and therefore yells at me if I try to import such a thing.

So, given that things that are supposed to just plain work just plain aren't... where can I go from here?

like image 775
DigitalMan Avatar asked Feb 10 '14 08:02

DigitalMan


People also ask

Does Java 1.8 include JavaFX?

JavaFX for Oracle Java 8 is not a separate installation. JavaFX is included in Oracle JDK 8 running on OS X, Linux x86 and Windows.

Why is JavaFX not included in JDK?

JavaFX was removed from JDK since JDK 11. Since JDK 9, java is modular. JavaFX was split into modules. Hence there is no longer a single jfxrt.

Which version of JDK has JavaFX removed from the JDK?

Starting with Java SE 11, JavaFX is not included in the Oracle JDK. Support for JavaFX on Java SE 8 will continue until March 2025.


1 Answers

Currently in Debian and Ubuntu (probably others) JavaFX is a separate package from the OpenJDK (openjdk-8-jdk) and so needs to be installed:

sudo apt-get install libopenjfx-java libopenjfx-java-doc

Notable issue (this issue does not impact a Maven, JavaFX application so if that is your preferred build method then ignore the following issue):

If you try to create a new project: Categories > JavaFX Project > JavaFXApplication

You'll get:

Internal error. Missing resources [/resources/web-files/javafx-loading-100x100.gif] 
/home/ken/NetBeansProjects/vestFxReports/nbproject/jfx-impl.xml:1465: The following error occurred while executing this line: 
/home/ken/NetBeansProjects/vestFxReports/nbproject/jfx-impl.xml:3093: The following error occurred while executing this line: 
/home/ken/NetBeansProjects/vestFxReports/nbproject/jfx-impl.xml:2055: Error: -includedt requires the java deployment toolkit, which is not included in this distribution 
BUILD FAILED (total time: 1 second)

To fix the above error [following steps are derived from here: http://hongouru.blogspot.com.uy/2015/09/solved-error-building-new-project-using.html]:

  1. Switch to the files tab (usually you're on the Project tab).
  2. Expand the node for your project > expand the nbproject node > open the "project.properties" file.
  3. Find the line javafx.deploy.includeDT=true and change true to false.

Now you can create and run a JavaFX application, on OpenJDK.


Next steps, although beyond the issue at hand you'll probably at some point want to download the JavaFX scene builder: http://www.oracle.com/technetwork/java/javafxscenebuilder-1x-archive-2199384.html

like image 83
Quaternion Avatar answered Oct 12 '22 12:10

Quaternion