Use of javc --release option with JavaFX

Matthew mhalver123 at
Thu Oct 5 04:17:37 UTC 2017

How exactly should the new release flag work when JavaFX is used.  Consider the following very simple (and not very useful) class (
        import javafx.application.Application;
        public class Testing {            public static void main(String... args) {}        }
This compiles perfectly fine under (Oracle's release of) JDK 8 using the command
and compiles just fine under JDK9 using the same command.  However when trying to target java 8 with JDK9 using
        javac --release 8
it results in an error package javafx.application does not exist
I have tried using the --add-modules option to include the JavaFX modules, but this flag does not work with release 8 targeted.  It does work if the jfxrt.jar file from the JDK8 directory is explicitly added to the classpath.  However, this requires us to have that file around, and thus have a second version of the JDK installed.
Is this the desired behavior?  I know that the release flag should release us from needing to set the bootclasspath to the desired rt.jar file, but should something that compiles fine under JDK8 and JDK9 with no extra jars (or even command line flags) needed require an extra jar when targeting java 8?

More information about the jdk9-dev mailing list