< Previous PageNext Page > Hide TOC

Using J2SE 5.0 on Mac OS X v.10.4

This chapter provides information on packaging your application so that it can require J2SE 5.0. It also includes the steps you need to take when developing J2SE 5.0 applications on Mac OS X v.10.4.

In this section:

Java Versioning
Java Developer


Java Versioning

Radar #4030615

The default version of Java after installing J2SE 5.0 Release 3

Description:

Java 1.4.2 remains the default version of Java used by applications and applets after installing J2SE 5.0 Release 3.

Resolution:

This allows applications built for Java 1.4.2 to continue running in Java 1.4.2.

To use the J2SE 5.0 version of any command-line Java utility, such as java or javac, specify the full path to the J2SE 5.0 version of the command. This usually means prepending the command with the path /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/.

The JVMVersion Info.plist key allows you to specify which Java virtual machine your application uses. Using either the 1.3+, 1.4+, or 1.5+ keys results in the Java virtual machine being used according to a precedence list set in the Java Application Settings portion of the Java Preferences application, found in /Applications/Utilities/Java/J2SE 5.0. By default in J2SE 5.0 Release 3, the precedence list follows this order:

J2SE 1.4.2
J2SE 5.0

Though not listed, Java 1.3.1 is considered to be the last entry on the list.

This works by trying to match the given key versus Java virtual machine versions in the list:

Table 1-1 lists the possible combinations of values when working with JVMVersion values and the Java Version Precedence List found in Java Preferences.

Table 1-1  Java virtual machine behavior, based on the JVMVersion key and the Java Version Precedence List in Java Preferences

Possible JVMVersion Value

Java virtual machine used if “J2SE 1.4.2” is listed first in Java Version Precedence List (Default)

Java virtual machine used if “J2SE 5.0” is listed first in Java Version Precedence List

1.5+(5.0 or “higher”)

J2SE 5.0

J2SE 5.0

1.5*(newest 5.0)

J2SE 5.0

J2SE 5.0

1.4+(1.4 or “higher”)

Java 1.4.2

J2SE 5.0

1.4*(newest 1.4)

Java 1.4.2

Java 1.4.2

1.3+(1.3 or “higher”)

Java 1.4.2

J2SE 5.0

1.3*(newest 1.3)

Java 1.3.1

Java 1.3.1

You can specify a specific version of Java as your JVMVersion key (such as 1.4.2 or 1.5.0), but if that precise version is not installed on the system, your application will fail to launch. This is not recommended.

To use an applet in Safari using J2SE 5.0, use the Applet portion of the Java Preferences application to select J2SE 5.0 as the virtual machine for applets. Java Preferences is found in /Applications/Utilities/Java/J2SE 5.0,

For information on configuring Xcode projects for use with J2SE 5.0, read “Xcode Java Projects in J2SE 5.0.”

Java Developer

Radar #4090917

Xcode Java Projects in J2SE 5.0

Description:

The Java project templates in Xcode are set up for use with Java 1.4.2.

Workaround:

Follow these steps to modify projects for use with J2SE 5.0:

Target Settings:

Double click the target to edit and provide /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/javac as the value for the JAVA_COMPILER build setting, available in the Expert View. Change the Target VM Version and Source Version in the Java Compiler Setting to use 1.5.

Executable Settings:

Double click the executable named java and enter /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java as the Executable Path in the General tab of Executable info.

Applet Development:

Double click the executable named appletviewer and enter /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/appletviewer as the Executable Path in the General tab of Executable info.

The Java Xcode project templates are currently set to specify a JVMVersion of 1.4*, meaning that your compiled application runs in Java 1.4.2. To run your application in J2SE 5.0, set the Target VM Version to 1.5*:

  1. Open the Target window for your application's build target

  2. Select the Pure Java Specific listing under Info.plist Entries

  3. For the Target VM Version field, enter 1.5*

Radar #4090919

J2SE 5.0 Reference Documentation

Description:

The J2SE 5.0 Reference Documentation is not installed automatically.

Workaround:

Install the J2SE 5.0 Release 3 Documentation package, available from the Downloads > Java page at http://connect.apple.com.

Note: J2SE 5.0 symbols are not used in the Xcode Documentation window by default. To use the 5.0 symbols instead of the 1.4.2 symbols, you need to modify which version of Java is indexed. To do this, follow the directions outlined in the workaround for “J2SE 5.0 symbols not visible in Xcode Documentation window.”

Radar #4310936

J2SE 5.0 symbols not visible in Xcode Documentation window

Description:

After installing the J2SE 5.0 Reference documentation or a documentation update in Xcode, J2SE 5.0 symbols are not present in the Xcode documentation window.

Workaround:

You need to manually run the pbhelpindexer utility for the J2SE 5.0 symbols to appear in the Xcode Documentation window. First, open MacOSXDeveloper.pbHelpIndexerList, located at:

/Developer/ADC Reference Library/indexes/

Replace this path:

/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Resources/

With this path:

/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Resources/

Finally, run this command in Terminal (it may take a while to finish executing):

sudo /Developer/Tools/pbhelpindexer



< Previous PageNext Page > Hide TOC


© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-01-10)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.