This article discusses the settings for the Info.plist Java Dictionary for Java 1.4 and J2SE 5.0 developers. Note that J2SE 5.0 is an optional installation for Mac OS X v.10.4. Your customers can download it through Apple's web site.
What is an Info.plist Java Dictionary Key?
Variables
Keys and Values
The Info.plist file is an XML property list file in a native Mac OS X application bundle. It defines certain attributes of the application for use by the operating system. The Info.plist file for a Java application wrapped as a Mac OS X application bundle contains a Java dictionary. This dictionary is just a subset of the Info.plist file that begins with:
<key>Java</key> |
<dict> |
and ends with
</dict> |
The Java dictionary allows you to set certain Java-specific attributes of your Mac OS X application.
Inside this Java dictionary you can have key and string combinations or key and dictionary combinations as illustrated in Listing 1.
Listing 1 Sample Info.plist Java dictionary
<key>Java</key> |
<dict> |
<key>JVMVersion</key> |
<string>1.4*</string> |
<key>MainClass</key> |
<string>com.yourCompanyName.YourApplication</string> |
<key>Properties</key> |
<dict> |
<key>apple.laf.useScreenMenuBar</key> |
<string>true</string> |
<key>apple.awt.showGrowBox</key> |
<string>true</string> |
</dict> |
<key>VMOptions</key> |
<string>-Xmx512m</string> |
</dict> |
Note that each key tag has a corresponding string or dict tag. Each dict tag surrounds other key/string or key/dict combinations.
The strings used to designate the values for the keys in the Java dictionary can use two special variables to simplify specifying path names. These variables should be used only in the Java dictionary of the Info.plist file. They are:
$JAVAROOTThe default Java root directory for an application bundle is Contents/Resources/Java. Use this variable to refer to that directory. If you want to change the Java root directory for the application bundle, add $JAVAROOT directory to the JNI search path
$APP_PACKAGEThis variable expands into the path to the root directory of the application bundle.
This section lists the keys and their valid settings for the Java dictionary of the Info.plist file.
MainClassThis is a required key. It designates the name of the class containing the application’s main method. If the classes are included in your application as a JAR file, you can use the com.companyname.classname addressing scheme to locate the main class within the JAR file.
JVMVersionThis key is recommended in any Info.plist file. It determines which version of Java the application is run with. Table 1 lists valid strings for the JVMVersion key along with a description of which version of Java is used. Without this key set, your application may not launch with the version of Java you intend—make sure to set it. With the Java 1.4.2 release, specifying a minor version of Java has been deprecated; instead use the asterisks (*) or plus (+) symbols with a major version. For example use 1.4+ instead of 1.4.2.
Note: If you do not set the JVMVersion key in a double clickable application, it runs in Java 1.4.2.
String | Java version used | Notes |
|---|---|---|
| 1.3.1 | Specifies an exact version of Java. It is recommended that you do not use this key unless absolutely necessary. |
| 1.3.1 | Requests the highest version of Java 1.3 available. Note that if Java 1.3 is updated in future releases of Mac OS X, the latest version of Java 1.3 will be used. |
| 1.4.2 | Requests the highest version of Java above 1.3. Note that if Java is updated in future releases of Mac OS X, the latest version of Java will be used. |
| 1.4.2 | Specifies the highest version of the Java 1.4 available. Note that if Java 1.4 is updated in future releases of Mac OS X, the latest version of Java 1.4 will be used. |
| 1.4.2 | Specifies the highest version of Java above 1.4. Note that if Java is updated in future releases of Mac OS X, the latest version of Java will be used. |
| 5.0 | Specifies the highest version of the J2SE 5.0 available. Note that if J2SE 5.0 is updated in future releases of Mac OS X, the latest version of J2SE 5.0 will be used. |
| 5.0 | Specifies the highest version of Java above 5.0. Note that if Java is updated in future releases of Mac OS X, the latest version of Java will be used. |
Note: Beginning with J2SE 5.0 Release 1, the Java Preferences application in /Applications/Utilites/Java/ determines how these key are interpreted. Users can change a precedence list which determines how the keys ending in "+" are interpreted. By default, the 1.4+ key results in Java 1.4.2 being used, even after J2SE 5.0 is installed. If a user places J2SE 5.0 over Java 1.4.2 in the precedence list, the 1.4+ key results in J2SE 5.0 being used for the application. Using the 1.5+ key always results in J2SE 5.0 being used.
ClassPathAllows you to explicitly set the path for required directories or JAR files. If you do not set this, the default class path is the root of the application bundle ($APP_PACKAGE).
WorkingDirectoryAllows you to modify the current working directory for the application from the default working directory at the root of the application bundle ($APP_PACKAGE).
ArgumentsA string or array of strings where each string is a space-separated list of arguments to pass to main as String[] . This is useful if your application expects to receive arguments passed in from the command line.
PropertiesProperties is a subdictionary of the Java dictionary. Valid keys for the Properties dictionary are system properties that you might pass into java from the command line with the -D flag. A list of valid properties is available in Java 1.4: Runtime System Properties.
Since the Properties key designates a dictionary, make sure to begin and end it with the dict keyword. “What is an Info.plist Java Dictionary Key?” shows an example of how to use the Properties dictionary.
VMOptionsSpace-separated list of strings, or an array of strings where each string is an options for the Java virtual machine. For example:
<key>VMOptions</key> |
<string>-Xms512m -Xmx1024m</string> |
is equivalent to
<key>VMOptions</key> |
<string>{"-Xms512m", "-Xmx1024m"}</string> |
Last updated: 2006-05-23