This chapter details significant improvements present in J2SE 5.0 Release 1 for Mac OS X.
Java Applets
Java Printing
Java Versioning
Cocoa Java Plugin Public API
Previously, there was no public API for using the Java Plugin in a Cocoa application.
There is a new Cocoa Java Plugin public API. This API can be used to embed Java into your Cocoa application. It’s documented in:
/System/Library/Frameworks/WebKit.framework/Headers/WebJavaPlugIn.h |
/System/Library/Frameworks/WebKit.framework/Headers/WebPlugin.h |
/System/Library/Frameworks/WebKit.framework/Headers/WebPluginContainer.h |
/System/Library/Frameworks/WebKit.framework/Headers/ WebPluginViewFactory.h |
Documentation for the behavior of plug-ins can be found in WebKit Plug-In Programming Topics.
javax.print Support
Previous Java releases for Mac OS X didn't support the javax.print
package.
J2SE 5.0 Release 1 supports javax.print
via
Mac OS X's CUPS implementation.
The current JDK and JRE after installing J2SE 5.0 Release 1
Java 1.4.2 remains the current JDK and JRE after installing J2SE 5.0 Release 1.
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/
.
The JVMVersion
Info.plist
key allows you to specify which JVM your application uses. Using
either the 1.3+, 1.4+, or 1.5+ keys results in the VM 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 1, 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 VM versions in the list:
Having 1.4+ specified first matches the “J2SE 1.4.2” value, so that is the VM used. Specifying 1.5+ means that 1.4.2 is skipped and the next choice, “J2SE 5.0,” is used.
If a user switches these values so that “J2SE 5.0” is first, an application that specifies 1.4+ runs in J2SE 5.0, since it’s the first entry and numerically superior to J2SE 1.4.2.
Table 1-1 lists the possible combinations of values when working
with JVMVersion
values
and the Java Version Precedence List found in Java Preferences.
Possible JVMVersion Value |
VM used if “J2SE 1.4.2” is listed first in Java Version Precedence List (Default) |
VM used if “J2SE 5.0” is listed first in Java Version Precedence List |
---|---|---|
|
J2SE 5.0 |
J2SE 5.0 |
|
J2SE 5.0 |
J2SE 5.0 |
|
J2SE 1.4.2 |
J2SE 5.0 |
|
J2SE 1.4.2 |
J2SE 1.4.2 |
|
J2SE 1.4.2 |
J2SE 5.0 |
|
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, found in /Applications/Utilities/Java/J2SE
5.0
, to select J2SE 5.0 as the virtual machine
for applets.
For information on configuring Xcode projects for use with J2SE 5.0, read “Radar #4090917.”
© 2005 Apple Computer, Inc. All Rights Reserved. (Last updated: 2005-10-04)