Modifying the Launch Command at Run Time

InstallShield 11 Universal » Launching Using Installation Launchers

The command issued by a launcher (both installation and application) can be modified at run time by providing additional run time settings in one or more files for which the launcher will automatically check when it executes. Each of the files must be in the same directory as the launcher itself and must have the same name as the launcher, but each must have a different extension.

The files for which a launcher checks are listed below, alphabetically by extension. The links in the "Extension" column go to an example of the described modification.

Extension Description of Modification
.cp This file should contain additional classpath entries to be included in the classpath at run time. There should be one entry per line with no classpath separators (the launcher provides these in a JVM neutral way). These classpath entries are added to the classpath after any classpath entries required by the JVM itself, but before the classpath entries required for the application being launched.
.cp1 This file is similar to the .cp file except that the classpath entries that it contains are prepended to very beginning of the classpath (before the classpath entries required by the JVM itself).
.cp2 This file is similar to the .cp file except that the classpath entries that it contains are appended to very end of the classpath.
.ja This file contains Java arguments to be included in the launch command (one per line). Java arguments provided in a .ja file appear in the launch command after any Java arguments specified in the Launcher bean definition. You can put JVM-specific arguments in this file for simplicity.

The following example is a JVM-neutral way to specify Java arguments:
%IF_EXISTS%("MAX_JAVA_HEAP", "@MAX_JAVA_HEAP@60m")

The MAX_JAVA_HEAP in the above example can be replaced by any of the settings provided for specific JVMs. To see these settings, examine the .jvm files in the <Universal home directory>/jvms directory. There is a setting name, followed by a colon (":"), followed by the value corresponding to that setting for that JVM. For example, in the sun_win32_122.jvm file, the MAX_JAVA_HEAP setting has the value -Xmx.

The %IF_EXISTS% function first checks to see if the setting specified as its first argument exists for the JVM being used to launch the Java application. If it does not, then the entire expression is replaced with an empty string. If the setting does exist, then the second argument is evaluated and the result is included in the command line for launching the Java application. During evaluation, the @MAX_JAVA_HEAP@ portion of the expression is replaced by the actual value for that setting from the JVM file. The 60m is included as a literal. Therefore, if the JVM is Sun 1.2.2, the additional Java argument would become -Xmx60m.
.sp This file contains system properties that should be included in the launch command. There should be one per line of the format propertyName=propertyValue. Do not include the actual command line switch (for example, -D) since the launcher provides this in a JVM-neutral way. Any settings provided in an .sp file appear in the launch command after the specified system properties in the Java application Launcher definition.

Examples

Each of the following examples assumes the following:

Example 1—.cp

Creating MyProduct.cp on the target machine in the same directory as MyProduct.exe with the following contents:

C:\bin\swing.jar
C:\bin\parser.jar

This would result in the launch command looking like the following:

C:\JRE\1.4\bin\jre.exe -classpath .;C:\JRE\1.4\lib\rt.jar;
C:\JRE\1.4\lib\classes.zip;C:\bin\swing.jar;C:\bin\parser.jar;
MyProduct.jar com.mycompany.myproduct.run

Example 2—.cp1

Creating MyProduct.cp1 on the target machine in the same directory as MyProduct.exe with the following contents:

C:\bin\swing.jar
C:\bin\parser.jar

This would result in the launch command looking like the following:

C:\JRE\1.4\bin\jre.exe -classpath C:\bin\swing.jar;C:\bin\parser.jar;
.;C:\JRE\1.4\lib\rt.jar;C:\JRE\1.4\lib\classes.zip;
MyProduct.jar com.mycompany.myproduct.run

Example 3—.cp2

Creating MyProduct.cp2 on the target machine in the same directory as MyProduct.exe with the following contents:

C:\bin\swing.jar
C:\bin\parser.jar

This would result in the launch command looking like the following:

C:\JRE\1.4\bin\jre.exe -classpath .;C:\JRE\1.4\lib\rt.jar;
C:\JRE\1.4\lib\classes.zip;MyProduct.jar;
C:\bin\swing.jar;C:\bin\parser.jar
com.mycompany.myproduct.run

Example 4—.ja

Creating MyProduct.ja on the target machine in the same directory as MyProduct.exe with the following contents:

%IF_EXISTS%("INIT_JAVA_HEAP", "@INIT_JAVA_HEAP@20m")
%IF_EXISTS%("MAX_JAVA_HEAP", "@MAX_JAVA_HEAP@40m")

This would result in the launch command looking like the following:

C:\JRE\1.4\bin\jre.exe -classpath .;C:\JRE\1.4\lib\rt.jar;
C:\JRE\1.4\lib\classes.zip;MyProduct.jar
 -ms20m -mx40m com.mycompany.myproduct.run

Example 5—.sp

Creating MyProduct.sp on the target machine in the same directory as MyProduct.exe with the following contents:

setting1="Value for setting 1"
setting2="Value for setting 2"

This would result in the launch command looking like the following:

C:\JRE\1.4\bin\jre.exe -classpath .;C:\JRE\1.4\lib\rt.jar;
C:\JRE\1.4\lib\classes.zip;MyProduct.jar -Dsetting1="Value for setting 1"
 -Dsetting2="Value for setting 2" com.mycompany.myproduct.run

Note

If the JVM had been jview, then the launch command would not have changed because the INIT_JAVA_HEAP and MAX_JAVA_HEAP settings are not supported by JVIEW.

See Also