I'm trying to decide whether I could switch to JavaFX for the user interface of my Java application. Most of my users would be using the Oracle JRE, which has JavaFX integrated these days. However, some are using OpenJDK (on linux). This (old) question suggests that OpenJDK deals very badly with JavaFX. According to this question, the alternative OpenJFX will only be fully integrated into OpenJDK in version 9. So my question is twofold:

  • Is the JavaFX support in OpenJDK still so bad?
  • If so, are there any Linux distributions that already offer an OpenJFX package so users wouldn't have to build it themselves?
share|improve this question
    
What is the execution mode of your application (how is it deployed?) – jewelsea Aug 31 '13 at 17:41
    
@jewelsea It runs as a standalone program. – mdriesen Aug 31 '13 at 18:00
    
@docM would it be a solution to switch to the oracle-(sun)-jdk for the ubuntu machines? webupd8.org/2012/01/… – nyyrikki Sep 1 '13 at 18:04
    
@nyyrikki That is an option. But I'd rather stick with Java Swing if JavaFX and OpenJDK don't mix. – mdriesen Sep 2 '13 at 17:31
2  
@Yngve I ported everything to JavaFX when Ubuntu and Debian started including the packages. – mdriesen Sep 15 '15 at 16:52
up vote 46 down vote accepted

JavaFX is part of OpenJDK

The JavaFX project itself is open source and is part of the OpenJDK project.

You can build an open version of OpenJDK (including JavaFX) completely from source which has no dependencies on the Oracle JDK or closed source code.

There are currently no Linux distributions that already offer an OpenJFX package so users wouldn't have to build it themselves.

Differences between Open JDK and Oracle JDK with respect to JavaFX

Oracle JDK includes some software which is not usable from the OpenJDK. There are two main components which relate to JavaFX.

  1. The ON2 VP6 video codec, which is owned by Google and Google have not open sourced.
  2. The Oracle WebStart/Browser Embedded application deployment technology.

This means that an open version of JavaFX cannot play VP6 FLV files. This is not a big loss as it is difficult to find VP6 encoders or media encoded in VP6. Other more common video formats, such as H.264 will playback fine with an open version of JavaFX (as long as you have the appropriate codecs pre-installed on the target machine).

The lack of WebStart/Browser Embedded deployment technology is really something to do with OpenJDK itself rather than JavaFX specifically. This technology can be used to deploy non-JavaFX applications.

It would be great if the OpenSource community developed a deployment technology for Java (and other software) which completely replaced WebStart and Browser Embedded deployment methods, allowing a nice light-weight, low impact user experience for application distribution. I believe there have been some projects started to serve such a goal, but they have not yet reached a high maturity and adoption level.

Personally, I feel that WebStart/Browser Embedded deployments are legacy technology and there are currently better ways to deploy many JavaFX applications (such as self-contained applications).

Who needs to create Linux OpenJDK Distributions which include JavaFX

It is up to the people which create packages for Linux distributions based upon OpenJDK (e.g. Redhat, Ubuntu etc) to create RPMs for the JDK and JRE that include JavaFX. Those software distributors, then need to place the generated packages in their standard distribution code repositories (e.g. fedora/red hat network yum repositories). Currently this is not being done, but I would be quite surprised if Java 8 Linux packages did not include JavaFX when Java 8 is released in March 2014.

Advice on Deployment for Substantial Applications

I advise using Java's self-contained application deployment mode.

A description of this deployment mode is:

Application is installed on the local drive and runs as a standalone program using a private copy of Java and JavaFX runtimes. The application can be launched in the same way as other native applications for that operating system, for example using a desktop shortcut or menu entry.

You can build a self-contained application either from the Oracle JDK distribution or from an OpenJDK build which includes JavaFX. It currently easier to do so with an Oracle JDK.

As a version of Java is bundled with your application, you don't have to care about what version of Java may have been pre-installed on the machine, what capabilities it has and whether or not it is compatible with your program. Instead, you can test your application against an exact Java runtime version, and distribute that with your application. The user experience for deploying your application will be the same as installing a native application on their machine (e.g. a windows .exe or .msi installed, an OS X .dmg, a linux .rpm or .deb).

share|improve this answer
10  
Debian now has an OpenJFX package: packages.qa.debian.org/o/openjfx.html – Emmanuel Bourg Sep 18 '14 at 23:03
6  
"Currently this is not being done, but I would be quite surprised if Java 8 Linux packages did not include JavaFX when Java 8 is released in March 2014". You must be surprised as OpenJDK 8 doesn't include OpenJFX. – user2022068 Nov 22 '14 at 7:45
6  
for this worked. sudo apt-get install openjfx – Vineel Kumar Reddy Kovvuri Mar 12 '16 at 10:44
2  
Arch Linux also has packages for openjfx: archlinux.org/packages/?name=java-openjfx – Maciek Łoziński Aug 20 '16 at 14:15
1  
@NoBugs This may be a little too late a response to be useful, but Ubuntu 14.04 doesn't include OpenJDK 8, which is why you can't find the corresponding JFX package. I can't recall which Ubuntu release introduced it, but it is definitely available in Ubuntu 16.04 - together with the "openjfx" package. – Mike Allen Dec 2 '16 at 2:02

For me this worked.

sudo apt-get install openjfx

share|improve this answer
2  
Probably the easiest way to add JavaFX to your Linux JDK – Reimeus Aug 1 '16 at 16:18
1  
This is the right answer (for me). – sureshvv Aug 4 '16 at 8:08
    
Although this is the right answer for many, some OSs don't provide this package. For those that don't webupd8 PPA for Ubuntu and fedy desktop installer for Fedora are two quick ways to setup the latest Oracle JDK/JRE which includes JavaFX. – QZ Support Sep 16 '16 at 19:45
    
see also here: stackoverflow.com/a/34244308/2849346 – MWiesner Jan 21 '17 at 11:45
    
For Ubuntu 16.10 this is the magic solution – MaanooAk Aug 12 '17 at 20:14

As a quick solution you can copy the JavaFX runtime JAR file and those referenced from Oracle JRE(JDK) or any self-contained application that uses JavaFX(e.g. JavaFX Scene Builder 2.0):

cp <JRE_WITH_JAVAFX_HOME>/lib/ext/jfxrt.jar     <JRE_HOME>/lib/ext/
cp <JRE_WITH_JAVAFX_HOME>/lib/javafx.properties <JRE_HOME>/lib/
cp <JRE_WITH_JAVAFX_HOME>/lib/amd64/libprism_*  <JRE_HOME>/lib/amd64/
cp <JRE_WITH_JAVAFX_HOME>/lib/amd64/libglass.so <JRE_HOME>/lib/amd64/
cp <JRE_WITH_JAVAFX_HOME>/lib/amd64/libjavafx_* <JRE_HOME>/lib/amd64/

just make sure you have the gtk 2.18 or higher

share|improve this answer

Try obuildfactory.

There is need to modify these scripts (contains error and don't exactly do the "thing" required), i will upload mine scripts forked from obuildfactory in next few days. and so i will also update my answer accordingly.

Until then enjoy, sir :)

share|improve this answer
1  
unfortunately there's no Windows counterpart for OpenJFX – madduci Nov 2 '17 at 6:51

According to Oracle integration of OpenJDK & javaFX will be on Q1-2014 ( see roadmap : http://www.oracle.com/technetwork/java/javafx/overview/roadmap-1446331.html ). So, for the 1st question the answer is that you have to wait until then. For the 2nd question there is no other way. So, for now go with java swing or start javaFX and wait

share|improve this answer
    
the link in your answer is broken. The closes thing I came to a similar page is oracle.com/us/corporate/press/1854982 – ILMostro_7 May 28 '14 at 9:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.