Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Apple Developer Tools for Java

This article provides a broad overview of Apple’s tools for Java development. It covers Apple’s Xcode IDE, the Jar Bundler application, and methods for obtaining and viewing documentation.

Contents:

Java Tools on Mac OS X
Xcode Tools
Other Tools
Developer Documentation


Java Tools on Mac OS X

The Java development tools in Mac OS X are similar to the tools you find in other UNIX-based Java development implementations. The command-line tools that Sun provides as part of the Java SDK for Linux and Solaris work the same in Mac OS X as they do on those platforms. There are only a few significant distinctions between the standard Java development tools in Mac OS X and those found on other UNIX-based platforms:

Apple provides additional tools for developing and distributing Java applications on Mac OS X. The following sections discuss Xcode, Jar Bundler, and other tools specific to Mac OS X.

Xcode Tools

Apple provides a full suite of general developer tools with Mac OS X. This suite of tools, the Xcode Tools, is free but not installed by default. The tools are available on the Mac OS v.10.4 DVD, and installers are included in /Applications/Installers/Developer Tools/ on new computers. The most current version of the developer tools is also available online at the Apple Developer Connection (ADC) Member Site http://connect.apple.com/.

Get the Current Tools

New features and bug fixes for the Mac OS X Developer Tools are released throughout the year. Even if you already have the Xcode Tools installed, you should check the Member Site (http://connect.apple.com/) for the most up-to-date version. You need to be enrolled as an ADC member to access that site. If you do not have an ADC membership, you can enroll for various levels of membership, including a free online membership that allows you access to the Member Site, at http://developer.apple.com/membership/.

The Xcode Tools are available from the Download Software link. There are two components to download that together give you the full Java development environment for Mac OS X. The Mac OS X section contains the base Xcode Tools. Download and install the most current released version available. There are also a Java–specific updates to the base developer tools, the J2SE 5.0 Developer Tools, which is available in the Java section. Download and install these as well.

With the Xcode Tools and the Java Developer Tools, you have a full-featured development environment including:

Xcode

The core component of the Mac OS X development environment is Xcode. Xcode is a complete integrated development environment (IDE) that allows you to edit, compile, debug, and package Mac OS X applications written in multiple languages. Even if you do not intend to use it for your primary Java development, become familiar with Xcode. Downloadable sample code and the sample code installed in /Developer/Examples/Java/ are both usually provided as Xcode projects. Additionally, there are some elements of documentation viewing that are available only through Xcode.

For more on using Xcode for Java development, see Xcode User Guide.

Using Xcode with J2SE 5.0

The Java templates in Xcode are setup for Java 1.4.2. To use J2SE 5.0 instead, modify these settings:

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. 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.

Jar Bundler

Jar Bundler is an application that turns pure Java applications into applications that can be launched just like native Mac OS X applications. Although the Terminal application is a part of every installation of Mac OS X, many Mac OS X users never use it. To prevent your users from having to use Terminal for your Java applications, you should wrap your application as a Mac OS X application bundle (See “Mac OS X Application Bundles”). Jar Bundler allows you to do this very easily. It also provides a simple interface for you to set system properties that make your applications perform their best in Mac OS X.

Jar Bundler is installed in /Developer/Applications/Java Tools/ with the Java Developer Tools. If Jar Bundler is not on your system and you see an application named MRJAppBuilder, you need to install the Java 1.4.2 Developer Tools Update. Jar Bundler replaces MRJAppBuilder and can be used for both J2SE 5.0 and Java 1.4.2 applications.

More information on Jar Bundler is available in Jar Bundler User Guide.

Applet Launcher

Applet Launcher (in /Developer/Applications/Java Tools/) provides a graphical interface to Sun’s Java Plug-in. Applet Launcher loads an applet from an HTML page. For example, entering the following URL launches the ArcTest applet:

file:///Developer/Examples/Java/Applets/ArcTest/example1.html

Applet Launcher is useful for seeing how your applets perform in J2SE 5.0 on Mac OS X. Performance and behavior settings for applets may be adjusted in the Java Preferences application installed in /Applications/Utilities/Java/J2SE 5.0/.

Note: Applet Launcher uses the J2SE 5.0 VM after J2SE 5.0 Release 4 is installed. To test applets with Java 1.4.2, change the Java Plug-in VM in Java Preferences and load the applet in Safari.

Other Tools

In addition to Applet Launcher, /Applications/Utilities/Java/ contains these Java-related tools that you might find useful when testing your application:

In addition to Xcode and Jar Bundler, /Developer/Applications/ contains some applications that you can use for Java development though they are not Java-specific. PackageMaker, FileMerge, and Icon Composer are a few examples that you might consider using.

Having a UNIX-based core at the heart of the operating system provides you with a host of general UNIX-based development tools as well. A look in /usr/bin/ shows many tools that make Java development in Mac OS X very comfortable if you are already accustomed to a UNIX-based operating system. (In the Finder, choose Go > Go to Folder... and type in /usr/bin/.) You will find emacs, make, pico, perl, and vi among others.

You can find additional development tools in the Darwin and OpenDarwin CVS repositories available at http://developer.apple.com/darwin/ and http://www.opendarwin.org/ respectively. For basic information on porting your favorite non-Java tools to Mac OS X, see Porting UNIX/Linux Applications to Mac OS X.

Developer Documentation

Documentation for Java development in Mac OS X is provided both online and locally with the installation of the Xcode Tools. The most current version of the documentation is available from the Java Reference Library on the Apple Developer Connection website. A snapshot of this documentation is also installed on your computer. This documentation is mainly HTML based, so you can view it in your choice of browser by launching the main navigation page at /Developer/ADC Reference Library/documentation/Java/index.html. Man pages for the command-line tools are accessible from the command line man program and through Xcode’s Help menu.

Note that Apple does not attempt to provide a full Java documentation suite online or with the Xcode Tools. Sun supplies very thorough documentation available online at http://java.sun.com/reference/docs/. Apple’s documentation aims to augment Sun’s documentation for Java development issues specific to Mac OS X and to document Mac OS X–specific features of Java. Your primary source for general Java documentation is Sun’s Java documentation web site.

Providing Documentation Feedback

If you find errors in the Java documentation or would like to request either feature or content enhancements, you can file bugs at http://bugreport.apple.com/. When filing documentation bugs for Java in Mac OS X, please use Java Documentation (developer) for Component and X as Version.

You may also send email feedback to javadevdoc@apple.com or use the feedback links at the bottom of ADC Reference Library documents and Tech Notes.



< Previous PageNext Page > Hide TOC


Last updated: 2006-05-23




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.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice