Java Dictionary Info.plist Keys
Info.plist file is an XML property list file in a native Mac app bundle. It defines certain attributes of the application for use by the operating system. The
Info.plist file for a Java application wrapped as an OS X application bundle contains a
Java dictionary. This dictionary is just a subset of the
Info.plist file that begins with:
and ends with
The Java dictionary allows you to set certain Java-specific attributes of your Mac app.
Inside this Java dictionary you can have
string combinations or
dictionary combinations, as illustrated in Listing 1.
Listing 1 Sample
Info.plist Java dictionary
Note that each
key tag has a corresponding
dict tag. Each
dict tag surrounds other
Creating an Info.plist file with Jar Bundler
OS X v10.5 and later include the Jar Bundler application, located in
/usr/share/java/Tools. Jar Bundler enables you to create an OS X application bundle for your Java application, complete with an automatically generated
Info.plist file. You can specify keys for the
Info.plist file in the Properties tab of Jar Bundler, or you can easily modify the file to suit your needs with the Property List Editor application (also located in
/Developer/Applications/Utilities) after generating the bundle.
For more information on Jar Bundler, see Jar Bundler User Guide.
In the Java dictionary of an
Info.plist file, the following variables are used to specify pathnames:
The default Java root directory for an application bundle is
Contents/Resources/Java. Use this variable to refer to that directory.
This variable expands into the path to the root directory of the application bundle.
This variable expands into the path to the current user’s home directory.
Keys and Values
This section lists the keys and their valid settings for the Java dictionary of the
This is a required key. It designates the name of the class containing the application’s
mainmethod. If the classes are included in your application as a JAR file, use the main class’s fully qualified class name, including its package, to locate the class within the JAR file.
This key is recommended in any Java application’s
Info.plistfile. It specifies the earliest version of Java that is compatible with the application. Table 1 lists valid strings for the
JVMVersionkey along with a description of which version of Java is used. Specifying a string with the asterisk (*) symbol is not recommended, because it may prevent your application from running in the latest Java VM available.
Note: If you do not set the
JVMVersionkey in a double clickable application, it runs in the first compatible version of Java specified by the user in the precedence list in the Java Preferences application.
Table 1 Values for specifying the Java version in OS X
Java version used
Specifies the highest version of Java 1.4 available. If no version of Java 1.4 is present, the default version of Java in Java Preferences is used. This string is not recommended.
Specifies the highest version of Java above 1.4. Note that if Java is updated in future releases of OS X, the latest version of Java is used.
Specifies the highest version of J2SE 5.0 available. If no version of J2SE 5.0 is present, the default version of Java in Java Preferences is used. This string is not recommended.
Specifies the highest version of Java above 5.0. Note that if Java is updated in future releases of OS X, the latest version of Java is used.
Specifies the highest version of Java SE 6 available. If no version of Java SE 6 is present, the default version of Java in Java Preferences is used. This string is not recommended.
Specifies the highest version of Java above Java SE 6. Note that if is updated in future releases of OS X, the latest version of Java is used.
Note: The Java Preferences application, in
/Applications/Utilities/, determines how these keys are interpreted. Users can change a precedence list that determines how the keys ending in a plus sign are interpreted. If a user places J2SE 1.4.2 over J2SE 5.0 in the precedence list, the
1.4+key results in J2SE 1.4.2 being used for the application.
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 (
The following architecture-specific class-path keys are also supported. Options provided to these keys are appended to the options provided to
ClassPathon systems with the corresponding architecture.
The current working directory for the application from the default working directory at the root of the application bundle (
A string or array of strings where each string is a space-separated list of arguments to pass to
String. This is useful if your application expects to receive arguments passed in from the command line.
A subdictionary of the
Javadictionary. Valid keys for the
Propertiesdictionary are system properties that you might pass into
javafrom the command line with the
-Dflag. A list of Apple-specific properties is available in Java System Property Reference for Mac.
Propertieskey designates a dictionary, make sure to begin and end it with the
dictkeyword. What is an Info.plist Java Dictionary Key? shows an example of how to use the
An array of string elements in which each string is an option for the Java virtual machine. For example:
A list of Apple-specific Java VM options is available in Java Virtual Machine Option Reference for Mac.
The following architecture-specific VM-option keys are also supported. Options provided to these keys are appended to the options provided to
VMOptionson systems with the corresponding architecture.
A list of the architectures preferred by the application. (Deprecated. Use the
lipotool or the
Note: The preferred way to express an architecture dependency is to use the
lipotool to remove the unsupported architectures from the JavaApplicationStub included in the application bundle. Developers should also use the
LSArchitecturePrioritykey in the top level of the
Info.plistfile, as native Mac apps do. See Launch Services Release Notes for more information.