Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is JavaFX available for every Java VM?

Tags:

javafx-8

I followed the "JavaFX is going to replace Swing" advice mentioned in several places (SO, Wikipedia, Oracle) but that seems to be a white lie. When I run a JavaFX app with IBMs V9 (build 2.8, JRE 1.8.0), I get:

java.lang.ClassNotFoundException: javafx.application.Application

I couldn't find any resource which explains whether JavaFX is a cross-VM technology or whether this is just another vendor-lock-in "feature".

Where is JavaFX available? If it's not available in some VM, can I install it or bundle it with my application?

like image 719
Aaron Digulla Avatar asked Nov 26 '25 04:11

Aaron Digulla


2 Answers

JavaFX is not available for every Java VM. For instance, Oracle Solaris Java distributions do not include JavaFX support.

JavaFX is available for many Java VMs. There are JavaFX runtimes available for (at least) the following platforms:

  • OS X, Windows, Linux, iOS, Android and various embedded architectures.

JavaFX download and source locations:

  • Binaries for some JavaFX runtimes (such as OS X, Windows and Linux) are provided by Oracle based upon Oracle JDK sources.
  • Binaries for some other runtimes (Android, iOS and embedded architectures) are provided by Gluon based upon Open JDK sources.
  • Binaries for Debian based Linux systems are in the Debian Package Tracker, based upon OpenJDK sources.
  • Open source code is available to build JavaFX for use with other platforms and Java VMs as part of the OpenJDK project.

For further information, see related questions and resources:

  • OpenJFX wiki site for open source JavaFX information.
  • What's the location of the JavaFX runtime JAR file, jfxrt.jar, on Linux?
  • JavaFXPorts: JavaFX to mobile and embedded hardware, including iPhone, iPad, Android devices, and the Raspberry Pi.
  • Java FX 2 on IBM jdk?
  • Certified configurations for JavaFX when running with Oracle Java 8 (Windows, OS X, Linux).

JavaFXPorts enables execution of JavaFX on the Android runtime natively and, currently via RoboVM, on the iOS runtime, for more info see: JavaFXPorts, how it works.

can I install it or bundle it with my application?

Yes.

  • Oracle JavaFX and OpenJFX distributions ship with tools for bundling JavaFX (and an appropriate Java runtime) with your application.
  • Gluon provides tools for packaging JavaFX applications for iOS and Android.
  • The JavaFX maven plugin supports bundling via a Maven based toolchain.
  • The JavaFX gradle plugin supports bundling via a Gradle based toolchain.

In terms of licensing for such distributions, I encourage you to do your own research.

  • Oracle Binary Code License (if you are bundling Oracle JRE).
  • OpenJDK Legal Documents (if you are basing the bundled components off of OpenJDK).
like image 98
jewelsea Avatar answered Nov 27 '25 18:11

jewelsea


It became integrated partially in Java 7 and more tightly in Java 8 so it should be standard in newer VM's and is slowly opening up. However, I wouldn't consider migrating from Swing to FX as a move up as much as a lateral move as explained here.

like image 32
David Cohen Avatar answered Nov 27 '25 17:11

David Cohen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!