--add-modules declarations)--add-opens declarations--add-exports declarationsAppLauncher program) with customized arguments specified in a configuration file:
AppLauncher classmain(String[]) method to create the launcher and call the AppLauncher.start() method which will start your application in a child process.MyApplication.jar application with the MyAppLauncher.jar launcher. The file structure must be:
MyAppLauncher.jar class should be:public class MyAppLauncher extends AppLauncher { public AppLauncher(String[] args) { super(args); } public static void main(String[] args) { MyAppLauncher launcher = new MyAppLauncher(args); launcher.start(); } @Override protected String getLaunchable() { return "MyApplication.jar"; } @Override protected String getConfigurationFile() { return "confFile.conf"; } }
--add-modules declaration)--add-opens declarations--add-exports declarations--add-modules declaration[1]
launcher.setAddModules("javafx.controls,javafx.fxml,javafx.graphics,javafx.swing,javafx.web");
---add-opens declarations with an ALL-UNNAMED value[2]
launcher.setAddOpensAllUnnamed("javafx.web/javafx.scene.web", "javafx.web/com.sun.webkit");
---add-exports declarations with an ALL-UNNAMED value[3]
launcher.setAddExportsAllUnnamed("javafx.web/javafx.scene.web", "javafx.web/com.sun.webkit");
{number} pattern, then the associated major version is required{number}- pattern, then the major version must be greater or equal to the associated number-{number} pattern, then the major version must be smaller or equal to the associated number{number}-{number} pattern, then the major version must be between the two associated numberslauncher.requireJavaVersion("11"); the major version must be 11 launcher.requireJavaVersion("11-"); the major version must be 11 or more launcher.requireJavaVersion("-11"); the major version must be 11 or less launcher.requireJavaVersion("9-11"); the major version must be between 9 and 11
"separateCustomArguments method is true, then the key and value will be on two separate argumentsmyKey=myValue in the configuration file will create in the arguments myKey=myValuetrue value for the method myKey=myValue in the configuration file will create in the arguments myKey myValuelauncher.setMainClass("my.main.MyApplication");
-appLauncher.conf=>path> argument when you start the launcher. The path can be absolute or relative to the directory of the launcher.
java -jar AppLauncher.jar -appLauncher.conf=myConfigFile.conf
If the path is empty, a file chooser will ask the user to select the file. For example:
java -jar AppLauncher.jar -appLauncher.conf=
JAVAHOME: Specifies the location of the JVM to use for the application to launchJAVAFXLIB: Specifies the location of the JavaFX libraries for use to the application to launchMODULEPATH: Specifies the "--module-path" argument. This is an alternate way of setting the "--module-path" through the API (see Specify the module paths)LIBPATH: Specifies the "java.library.path" argumentVMARGS: Specifies additional VM arguments to useREQUIRE_VERSION: Specifies the required JVM version. This is an alternate way of setting it through the API (see Specify the required Java version)ENV:<environment variable name>: environment variables that you want to set for the application processJAVAHOME property specifies the location of the JVM to use for the application to launch.
JAVAHOME=L:\WRK\Java\Tools\jdk-17.0.2
JAVAFXLIB property specifies the location of the JavaFX libraries for use to the application to launch.
JAVAFXLIB=L:\WRK\Java\Tools\javafx17\lib
MODULEPATH property specifies the "--module-path" argument. This is an alternate way of setting the "--module-path" through the API (see Specify the module paths).
MODULEPATH=javafx.controls,javafx.fxml,javafx.graphics,javafx.swing,javafx.web
LIBPATH property specifies the java.library.path argument.
VMARGS property additional VM arguments to use. The arguments must be separated by spaces.
REQUIRE_VERSION property specifies the required JVM version. This is an alternate way of setting it through the API (see Specify the required Java version).
ENV:<environment variable name> properties specify environment variables that you want to set for the application process.ENV:HOMEPAGE=http://my.homepage.html
JAVAHOME=L:\WRK\Java\Tools\jdk-17.0.2 myKey=myValue
Copyright 2006-2024 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences