Launching JavaFX apps
Florian Brunner
fbrunnerlist at gmx.ch
Wed Feb 12 14:07:22 PST 2014
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 <https://bugs.openjdk.java.net/browse/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
> > <https://javafx-jira.kenai.com/browse/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