The Advanced Installer Native Java Launcher is a small executable program whose role is to load and start your Java Application. It effectively replaces java.exe and it incorporates functionality, while providing better Operating System integration and a more user-friendly operation.
When you define a Java Product in the Java Products page, a copy of the launcher (having the name you choose) will be inserted into the install package. This effectively becomes your Application. It will show up in the Files and Folders page, you can create shortcuts to it, add it to the PATH environment variable, and pretty much anything you would do with a regular Windows native application. A customized version of the launcher is installed if your application is a GUI application, a console application or a Windows service.
After the user installs your package, when the launcher is started (using a shortcut), it will perform the steps outlined below. If, at any point, an error occurs, the launcher will display a detailed message box (or print on the stdout for console applications) and exit.
1. Read its configuration.
Advanced Installer will place the launcher options into an INI file with the same name as the launcher and installed into the same directory. The information in this file cannot be modified from inside the project.
2. Display the Splash Screen.
If this is a GUI application and you have specified a splash screen, it will display it. This splash screen can have a shadow if it was specified and the operating system supports it.
If a splash screen had been specified but you don't want to display it use one of the following command line options for the launcher:
3. Look for a bundled JRE.
The launcher will look in its home directory, and expect to find the bundled JRE in a "jre" sub-directory of its home directory or straight into its home directory. The user can override this behavior to force the usage of another VM, by opening the INI file and adding the following entry:
[Java Runtime Environment] JRE Path = <path_to_jre>
4. Look for an installed JRE.
If there was no bundled JRE, the launcher will look for a JRE previously installed on the user's machine. If multiple JREs are present, it will choose the current one - usually the latest version. The preferred version will be selected if it was specified in the Preferred JRE Version Dialog.
5. Check the run conditions.
If there is no JRE present, the launcher will put up a
dialog box with the following message and exit:
"Java Runtime Environment (JRE) not found. Please download and install JRE (%ver%) from: http://www.java.com"
If the JRE version is outside of the specified range, the launcher will put up a dialog box with the following message and exit:
"Your JRE is (%msg%). Please download and install another one (%ver_msg%) from: http://www.java.com"
6. Load the Java Virtual Machine, load your classes and execute the Main method of your main class.
Once the Java Virtual Machine was selected, the launcher will prepare to load it. It will also set two environment variables that store the absolute path to the Java Runtime Environment and to the Java Virtual Machine library.
- AI_JVM_HOME - stores the full path to the selected JRE. e.g.: C:\Program Files\Java\jre1.5.0_03
- AI_JVM_PATH - stores the full path to the JVM library. e.g.: C:\Program Files\Java\jre1.5.0_03\bin\client\jvm.dll
Depending on the application type, the Virtual Machine will
be launched in Console mode, with a Graphical User Interface or as a
Win32 Service. The command line options are passed as arguments to the
Main method. The specified Virtual Machine parameters are passed to
the Java Virtual Machine.
This step lasts until Main() method returns.
7. Take the Splash Screen down.
If there was no splash screen or this is a Console application or a Windows Service, this step is skipped.
8. Wait for the Java Program to finish, shut down the VM and exit.
This normally happens when the last Java thread was
terminated. In case of a Service application, the program can be
stopped by the Service Control Manager (one stops the service from the
services applet or when the application calls the Service Control
Manager and stops the service).