Article ID: 000017
Last Revised On: 29-Sep-2005
PDF Version: 000017.pdf
The information in this article applies to:
This article does not apply to Excelsior JET 4.0 and above.
The similar article for Excelsior JET 4.0 and above can be found here 000026.
Commercial Editions of Excelsior JET include Excelsior Installer, which you may use to deploy your JET-compiled Java applications. However, the capabilities of Excelsior Installer are limited to very basic operations, such as file copying and creation of Start Menu shortcuts. For more sophisticated setups, you need to write custom extension DLLs or use a third-party setup generator.
This article describes creation of setup packages for JET-compiled applications using third-party tools. The example section contains step-by-step instructions for creating a setup package with NSIS (Nullsoft Scriptable Install System.)
Control files for this article may be found here.
After you have created an executable using Excelsior JET, you need to make a setup package for further distribution of the compiled application to your end users. Before you begin, you should know several things:
Certain applications may be processed with JetPerfect Global Optimizer (available only in Excelsior JET, Professional Edition.) It links both application classes and platform classes together into a single executable that does not need the above mentioned runtime DLLs.
If you do not use JetPerfect, it is necessary to deploy one or more runtime DLLs along with the application executable. The JetPackII tool will help you determine which runtime DLLs are needed for your executable to work.
The exceptions from this rule are applications that do not use AWT/Swing, i.e. those built using third-party AWT-independent GUI toolkits, such as SWT or LWJGL, or not providing GUI at all (batch/console/server-side). Such applications may work without the JRE if you compile them using Excelsior JET, Professional Edition.
(Note: Your program may use AWT and Swing indirectly; for example, there is an xml-to-pdf converter which for no apparent reason requires AWT).
For details, see the "JRE-less operation" section of Excelsior JET User’s Guide, Chapter "Application Considerations".
To summarize, if you have created a JRE-independent executable using JetPerfect, the installation process can be as simple as just copying the application to the target system. If that is not the case, additional files have to be copied and executable patching may be required.
Two options define the actions the installer must perform: placement of the JRE and the number of root directories.
A root directory is an abstract destination directory for some or all of the installation package files. The actual pathname for each root, such as C:\Program Files\My App, is usually assigned at install time.
All files are copied into one application-specific directory and its subdirectories. The relative directory hierarchy positions of JET runtime DLLs and/or the JRE with respect to your JET-compiled executables are known beforehand, so those executables are patched by JetPackII.
Files are copied to completely different locations, maybe even to different drives. JET-compiled executables must be patched at install time.
Options for JRE placement are as follows:
The executable(s) being deployed do not require the JRE at all. No extra installer action necessary.
The required version of the JRE is included in the setup package. The installer must copy it to the target system. In case of a single root, the executables will be patched by JetPackII and no further action is necessary to make them work. Otherwise, XBIND must be run to write the JRE location into the exectuables.
The JRE is not included into the setup package but the application requires the JRE. In other words, it relies upon the presence of the proper version of the JRE on the target system. So the installer must find the JRE and “inform” the executable(s) of its location through patching.
Consider the following sample scenarios:
These scenarios take place if the following selections are made in JetPackII:
On the final page (step 10 of 10), specify the location where to put the files prepared for the distribution (the image), for example C:\MyAppImage, and then click Create. When JetPackII finishes creating the image you will find the set of files ready for distribution in the C:\MyAppImage directory. All the installer has to do is copy the contents of this directory to the target computer, preserving the subdirectory structure.
The following selections are made in JetPackII:
After JetPackII creates the image you will find the following content in the specified image directory (suppose its name is C:\MyAppImage:
C:\MyAppImage\Root\ C:\MyAppImage\xbind.exe C:\MyAppImage\xbind.script C:\MyAppImage\jrelookup.dll (since version 3.5)
where the C:\MyAppImage\Root directory contains the files and directories constituting the installation package, xbind.exe is the patching utility, and xbind.script is its control file. jrelookup.dll, introduced in Excelsior JET 3.5, is a helper DLL providing JRE lookup API (see below.)
Now, the installation program should perform the following steps to make the application work on target system:
Note: JET-compiled applications require exactly the same JRE version as specified in the respective JET Profile.
Root="C:\Program Files\My App" JRE="C:\JRE"
Note that quotes around the paths are required.
C:\tmp\xbind.exe C:\tmp\xbind.script C:\tmp\xbind.red
If xbind returns zero errorcode then the utility succeeded and the patched executables are ready to work. The only thing the installer has to do now is to remove the files it created in the temporary directory.
These scenarios take place if the following selections are made in JetPackII:
When JetPackII create the setup image you will find the following content at the specified location (it is similar to the image for the "Single root, external JRE" scenario):
C:\MyAppImage\Root1\ C:\MyAppImage\Root1\ . . . C:\MyAppImage\RootN\ C:\MyAppImage\xbind.exe C:\MyAppImage\xbind.script C:\MyAppImage\jrelookup.dll (appeared since version 3.5)
where the C:\MyAppImage\RootX directories contain directory structures and files you defined in JetPackII for each respective root.
To make the application work on the target system, the installation program should perform the following steps:
When the JRE is included in the package (“internal JRE”), it is placed in one of the root directories and therefore must be copied to the target system on this step. Suppose the JRE was copied to JRE-Location.
Root1="Root1-Location"
Root2="Root2-Location"
. . .
RootN="RootN-Location"
JRE="JRE-Location"
Note that quotes around the pathnames are required.
C:\tmp\xbind.exe C:\tmp\xbind.script C:\tmp\xbind.red
If xbind returns zero errorcode then the utility succeeded and the patched executables are ready to work. The only thing the installer has to do now is to remove the files it created in the temporary directory.
In order to reduce the size of the resulting setup package you may decide not to redistribute the JRE, if you can assume it will be present at enduser systems (which is a reasonably safe assumption in a corporate environment.) As it was mentioned above, in this case the installer will have to locate the JRE of the proper version on the target system.
The JRE Lookup API was made for helping the installer to locate the JRE. It includes jrelookup.dll (which can be found alongside the xbind tool in the installation package image) and the header file jrelookup.h (located in the include subdirectory of your JET installation).
The API provides the following set of functions (please refer to Excelsior JET User’s Guide or the jrelookup.h files for the exact description of each function.)
int STDCALL JRELookup_GetVersion (char* buffer, int bufferlen); int STDCALL JRELookup_Lookup (); int STDCALL JRELookup_GetCount (); int STDCALL JRELookup_GetPath (int index, char* buffer, int bufferlen); int STDCALL JRELookup_IsInternational (int index); int STDCALL JRELookup_IsPublic (int index); int STDCALL JRELookup_AddDirectory (const char* dir);
The common usage scenario of the JRE Lookup API would be:
If the API fails to find any JRE, the setup program should prompt the user for the path to the JRE of the proper version, which can be obtained by calling JRELookup_GetVersion(). Then setup should pass the pathname specified by user to JRELookup_AddDirectory() to check if it really contains a proper JRE.
In this example it would be shown how to create a "Single root, external JRE" setup for the hello application using NSIS (Nullsoft Scriptable Install System). Let’s perform the following steps:
/Root /JET RT hello.exe
|
Home | Company | Products | Services | Resources | Blog | Contact | Request a Call Site: Search | Sitemap | Forum | Credits © 1999-2009 Excelsior LLC. All Rights Reserved. |