Launching JavaFX apps

David DeHaven david.dehaven at
Wed Feb 12 16:00:45 PST 2014

Use of JavaFX-Class-Path is supported but highly discouraged as it leads to ClassLoader juggling, it was required when there was no SE launcher support for JavaFX. It is only supported for backward compatibility, new applications should NOT use it.

Either JavaFX-Application-Class or Main-Class can be used to specify the main entry point for the application. If both are present, then JavaFX-Application-Class will be used. Whichever is used, the presence of main is not required if it's a JavaFX application as the entire launch process is handed over to the JavaFX launcher impl. As with JavaFX-Class-Path, use of JavaFX-Application-Class is now discouraged but not quite as strongly.

The SE launcher ignores JavaFX-Version. I don't think it's used any more in JavaFX either, the only mention of it is "// If we ever need to check JavaFX-Version, do that here..." in

JDK-8001533 allowed Main-Class to specify a JavaFX application as the main class, but it ignored JavaFX-Application-Class (among others)
JDK-8004547 fixed the above issue, the SE launcher now checks for J-A-C in the manifest and uses it as the Main-Class if present


On Feb 12, 2014, at 2:07 PM, Florian Brunner <fbrunnerlist at> wrote:

> Could someone elaborate on this?
> Thanks!
> -Florian
> Am Samstag, 18. Januar 2014, 13.27:07 schrieb Florian Brunner:
>> Hi Kevin,
>> Thanks for this clarifiacation! I'm also interested in this kind of information as I'm in the process of upgrading Drombler FX to JavaFX 8 and Drombler FX comes with a custom Maven Plugin, which makes sure the application can start.
>> Another related question:
>> While the Ant task for JavaFX 2.x added the following Manifest entries:
>> JavaFX-Version: 2.2
>> JavaFX-Application-Class: myPackage.MyApplication
>> JavaFX-Class-Path: 
>> Main-Class: com/javafx/main/Main
>> the Ant task for JavaFX 8 added the following Manifest entries:
>> JavaFX-Version: 2.2
>> Class-Path: 
>> Main-Class: myPackage.MyApplication
>> So it seems "JavaFX-Application-Class" is not used anymore if one doesn't use com.javafx.main.Main to start the JavaFX application, and "JavaFX-Class-Path" has been replaced with the standard "Class-Path" entry.
>> The "JavaFX-Version" seems still to be needed, however. For what is it used? An why is this version set to "2.2" for JavaFX 8 applications? Shouldn't it be "8.0" or something?
>> Can I get this version from somewhere? Either the JavaFX API or from the ant-javafx.jar?
>> -Florian
>> Am Mittwoch, 8. Januar 2014, 06.45:36 schrieb Kevin Rushforth:
>>> Hi Scott,
>>> The Java 8 launcher has been modified to recognize JavaFX applications 
>>> -- that is, classes that extend javafx.application.Application -- and 
>>> launch them directly by calling into the JavaFX launcher code. See 
>>> JDK-8001533 <>. This is 
>>> why the com.javafx.main.Main class is no longer needed.
>>> Somewhat independent of this, for standalone applications (but not 
>>> applets or web start applications) the JavaFX launcher code will now 
>>> call the main() method if it is present (see RT-28755 
>>> <>), but will still happily 
>>> launch the application if it isn't. So the main() method is still 
>>> optional. If present, it must call Application.launch() in order to 
>>> launch the application.
>>> So yes, it does seem that Netbeans should modify the wording of their 
>>> javadoc comment for the main() method of a JavaFX application.
>>> -- Kevin
>>> Scott Palmer wrote:
>>>> Based on the discussion I saw in the comments for RT-34236 I discovered
>>>> that using com.javafx.main.Main is not the way JavaFX 8 is supposed to
>>>> work. There are comments that read, "...making sure their Application class
>>>> has a main that calls launcher(String[] args)."
>>>> This seems to imply that a main method is now required in the Application
>>>> class when writing apps for JavaFX 8.
>>>> Is this correct?
>>>> If so. Somebody should tell NetBeans to stop injecting this comment in the
>>>> generated application class for JavaFX projects:
>>>> /**
>>>> * The main() method is ignored in correctly deployed JavaFX application.
>>>> * main() serves only as fallback in case the application can not be
>>>> * launched through deployment artifacts, e.g., in IDEs with limited FX
>>>> * support. NetBeans ignores main().
>>>> *
>>>> * @param args the command line arguments
>>>> */
>>>> Are the changes to the launching of JavaFX apps docuemtned somewhere?  Is
>>>> using javafxpackager or the ant task the *only* supported way of creating
>>>> JavaFX applications?  I'm currently using my own stub that runs on Java 7
>>>> and adds the jfxrt.jar to the classpath if required and then calls the
>>>> launch method on the Applicaiton class.
>>>> Regards,
>>>> Scott

More information about the openjfx-dev mailing list