public class Main
extends Object
This class loads com.sun.javafx.application.LauncherImpl and calls the
launchApplication method.
It is used by packager to include it as part of the application jar file
so that we can run and locate the JavaFX runtime. Note that we cannot
assume that JavaFX is on the classpath so we must use reflection and not
have any direct reference to any JavaFX runtime class.
We will do the following:
1. Verify the version of Java and produce error message if not JDK6+
2. Locate the jar file from which the Main class was launched. Read the
jar manifest and extract
the application class using the JavaFX-Application-Class manifest entry.
Alternatively, we will read the application class from a system property.
3. Try to locate the JavaFX runtime by loading the
com.sun.javafx.application.LauncherImpl class using the following mechanisms
in order:
A. Try loading it directly in case it is on the classpath.
B. If the javafx.runtime.path System Property is set, try
loading it from ${javafx.runtime.path}/lib/ext/jfxrt.jar
(or lib/jfxrt.jar)
C. Look for a cobundled JavaFX in the current jre
D. If on Windows, read the registry key associated with the JavaFX
runtime (if running in a 64-bit JVM, use the 64-bit path)
4. Create a custom URLClassLoader from the appropriate jar files, and then
call the launchApplication method. If the application class is not a
subclass of javafx.application.Application then we will call the main
method in the application class instead.
5. If the LauncherImpl class cannot be found, then show a Swing dialog
(again, using reflection).