Bookmark Topic Watch Topic
  • Mark post as helpful
  • send pies
  • Report post to moderator
This page collects information about Java development on Mac OS X. Note that some of these resources deal specifically with Apple's now obsolete implementations of Java 6 and older, not the current OpenJDK implementations of Java 7 and 8 (which mostly behaves like the Linux implementation).

Q: How do I compile my first Java program on my Mac?

A: Simplest way is to use a text editor and the Terminal application that comes with your Mac, as described here.

Q: Why are Apple's Java releases continuously behind Sun's?

A: For most people this is not the big deal it's being made out to be, annoying though it may be. See here for some discussion. Update: With Java development now having passed from Apple to the OpenJDK project, this is no longer an issue.

Q: How do I properly set up Tomcat on OS X, with its own user account and everything?

A: Luckily, someone has taken the time to write it all down; get all the details here, and there's also good information at

Q: How do bundle my Java application so that it looks like a native OS X application?

A: Apple provides a tool called Jar Bundler for this purpose, which is part of the Xcode Development Tools. It can bundle any number of jar files inside a Cocoa launcher, helps provide a proper icon and application menu title, and more.

You can use the hdiutil tool to create a disk image; type man hdiutil on the command line to learn more about it. It can be invoked from an Ant build like this (assuming that is the application built by Jar Bundler):

There's also a third-party Ant task which does something similar.

JWrapper creates a native OSX app along with other platforms.

If you need a native OS X installer for your Java application, the way to do it is described here.

Q: Can I develop for JME (Java Micro Edition) and/ Android on OS X?

A: The JME SDK 3.0 was available (although without Blu-Ray support, which Macs don't support), but it has apparently been withdrawn. An SDK for JME 8 is not available. See this discussion for some other options. The Android SDK is available for OS X.

Q: My applet was compiled with Java 6, but it doesn't run on the Mac; what gives?

A: Not all versions of OS X support all versions of Java. For example, OS X 10.4 and earlier do not support Java 6, and OS X 10.6 and earlier do not support Java 7. All the details can be found in Apple's Technical Note 2110.

Useful Resources

  • Apple OSXAdapter code sample : Apple's Java implementations provides several useful classes that allow a Java application to make use of Mac-specific functionality, particularly how to receive events and display menus in the Application menu, which is otherwise out of reach for Java code. This sample demonstrates how to use these classes.

  • AppleJavaExtensions : In order to compile code that uses the Apple-specific classes on other platforms, these stub classes can be used at compile time on non-OS X platforms. The javadocs of those classes are here

  • Identifying Java on Mac OS X provides an overview of which Java version runs on which OS X version, and how they can be detected at runtime.

  • Tailoring Java Applications for Mac OS X : Tips on how to make a Java application behave more Mac-like on OS X. The document is marked obsolete, but still contains good advice. New Control Styles available on Mac OS X 10.5 outlines further possibilities to provide a more Mac-like Swing appearance.

  • Make Your Swing App Go Native (part1 part2 part3) is a series of articles about how to make Swing applications behave according to the OS they run on, with particular emphasis on OS X and Windows.

  • Apple's Java Development Guide.

  • Mac Widgets for Java "Mac Widgets for Java are a collection of widgets seen in OS X applications, offered in a Java API. These widgets help Java developers create more Mac-like applications. There usage is not restricted to Mac though, as they will render across platforms."

  • CategoryFaq
      Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!