This content has been marked as final. Show 1 reply
I think the JavaFX-generated Main.class you are referring to is also known as the "JavaFX launcher".
A description of what the launcher does is here (http://docs.oracle.com/javafx/2.0/deployment/packager001.htm):
"By default, the Create JAR command also inserts the JavaFX Launcher into the JAR archive. The JavaFX Launcher is responsible for locating the installed JavaFX Runtime and invoking the main application class using this Runtime. The JavaFX Launcher also enables the JAR file to be run by double-clicking the file. Use the -noembedlauncher option to keep the launcher from being embedded."
So, it seems the use of the launcher is optional. If you don't need or want the extra functionality the launcher provides, then you don't need to include it in your package.
To run your application without the launcher, place the jfxrt.jar file on your classpath (e.g. with the java -cp <jfxrt.jar path> -jar your jar file). As long a correct version of JavaFX and Java is installed on your machine, I believe your application should run fine. If you are just executing the class files locally for development purposes, you don't need to bother with the jar step and can just use something like java -cp <jfxrt.jar path>;. com.app.AppMain (see Command-line/Runtime.exec() JavaFX app?
To build your application, you don't need to use NetBeans or Ant scripts, for example I build apps for development using compilation and packaging tools built into intellij Idea (with jfxrt.jar added as a library to the project). I have also used modified versions of the maven script here http://truezip.schlichtherle.de/2011/10/04/updated-maven-archetype-for-javafx-2-0-in-scala (note that this example uses the optional ant tasks to get more functionality). Additionally, I have done some command line based development using the javafxpackager tool (see here How to compile JavaFX 2.0 app with javac.exe from command prompt? for a sample batch build file).
If you use the ant scripts, the javafxpackager tool, or netbeans (which just relies on the ant scripts for build) then you do have more packaging options available then if you don't use those scripts (for example binary compilation of css, inclusion of the javafx launcher, etc), but they are only desirable, not necessary, tools for development of javafx projects.
If you are interested, there are also threads on maven development on the open-jfx mailing list (http://mail.openjdk.java.net/pipermail/openjfx-dev/2011-December/thread.html, http://mail.openjdk.java.net/mailman/listinfo/openjfx-dev), you can post there to discuss the launcher or maven support if you wish.