Java Application For Mac Os X

  1. Java For Mac Os X 10.6.8
  2. Java For Mac Os X
  3. Free Application For Mac

The following are the system requirements for installing the JDK and the JRE on macOS:

  • Any Intel-based computer running macOS.

  • Administrator privileges.

    You cannot install Java for a single user. Installing the JDK and JRE on macOS is performed on a systemwide basis for all users. Administrator privileges are required to install the JDK and JRE on macOS.

  • When you install the JDK, it also installs the JRE. However, the system will not replace the current JRE with a lower version.

    To determine the current JRE version installed on your system, see Determining the JRE Version Installed on macOS. To install an earlier version of the JRE, you must first uninstall the current version. See Uninstalling the JRE on macOS.

  • When you install the JRE, you can install only one JRE on your system at a time. The system will not install a JRE that has an earlier version than the current version.

    To determine the current JRE version installed on your system, see Determining the JRE Version Installed on macOS. To install an earlier version of the JRE, you must first uninstall the current version. See Uninstalling the JRE on macOS.


    Installing a JRE from Oracle will not update java -version symlinks or add java to your path. To do this, you must install the JDK.


Without any changes, JUnit on Mac OS X looks like this: Figure 2. JUnit running under Mac OS X. We get a lot for free. If you don't specify a look and feel for your Java application, the Aqua look and feel is used as the default on Mac OS X.

  1. If you have not yet installed Apple's Java OS X 2012-006 update, then you are still using a version of Apple Java 6 that includes the plug-in and the Java Preferences application. See Notes for Users of macOS That Include the Apple Java 6 Plug-in.
  2. Creating a Mac OS X package for a Java application The following article uses options that are available starting with the Professional edition and project type. This tutorial will guide you through the packaging of a Java application into a Mac OS X compliant package.

These documentation pages are no longer current. They remain available for archival purposes. Please visit for the most up-to-date documentation.

This page shows you, step by step, how to convert a simple Java application to a version you can distribute on a Mac. To follow along, download the ButtonDemo (.zip) example from the Java Tutorial. This example was created using NetBeans which uses the Ant utility. You can run all necessary tools and make all necessary edits from the command line, without launching NetBeans. The Ant tool is required.

You have created a Java application and want to bundle it for deployment. This requires the following steps:

Create a JAR File

This step creates the ButtonDemo.jar file.

Java For Mac Os X 10.6.8

Execute ant jar in the high-level project directory to create the dist/ButtonDemo.jar file. This jar file is used to create the .app package.

Bundle the JAR File into an App Package

To create the package, use the appbundler tool. The appbundler is not shipped with the 7u6 version of the Oracle JDK for the Mac. You can download it from the Java Application Bundler project on There is also AppBundler Documentation available.

As of this writing, the most recent version is appbundler-1.0.jar, which is used by this document. Download the latest version available and substitute the file name accordingly.

  1. Install the appbundler-1.0.jar file. In this case, create a lib directory in the high-level project directory and add the appbundler-1.0.jar file.
  2. Modify the build.xml file in the high-level project directory as follows. (The added code is shown in bold.)
  3. Invoke the appbundler by typing ant bundle-buttonDemo from the high-level project directory. This creates the package in the dist directory.
  4. You should now be able to launch the application by double clicking in the Finder, or by typing open at the command line.

Bundle the JRE with the App Package

In order to distribute a Java application, you want to avoid dependencies on third party software. Your app package should include the Java Runtime Environment, or JRE. In fact, the Apple Store requires the use of an embedded JRE as a prerequisite for Mac App Store distribution. The runtime sub-element of the <bundleapp> task specifies the root of the JRE that will be included in the app package.

In this example, the location of the JRE is defined using the JAVA_HOME environment variable. However, you might choose to bundle a JRE that is not the same as the one you are using for development. For example you might be developing on 7u6, but you need to bundle the app with 7u4. You will define runtime accordingly.

Since this example defines the runtime sub-element using JAVA_HOME, make sure it is configured correctly for your environment. For example, in your .bashrc file, define JAVA_HOME as follows:

Use the following steps to modify the build.xml file at the top of the project directory:

  1. Specify an environment property, named env:
  2. In the target that creates the bundle, specify the location of the JRE on your system, using the env property:

The resulting build.xml file should look like the following. (The new lines are shown in bold.)

Create a fresh version of, using the ant bundle-buttonDemo command. The resulting version includes the JRE in the app package. You can confirm this by examining the Contents/PlugIns directory inside of the app package.

Sign the App

The Gatekeeper feature, introduced in Mountain Lion (OS X 10.8), allows users to set the level of security for downloaded applications. By default, Gatekeeper is set to allow only OS X App Store and Developer ID signed applications. Unless your app is signed with a Developer ID certificate provided by Apple, your application will not launch on a system with Gatekeeper's default settings.

For information on the signing certificates available, see Code Signing Tasks on


The signing certificate contains a field called Common Name. Use the string from the Common Name field to sign your application.

Sign your app using the codesign(1) tool, as shown in the following example:

Java For Mac Os X

To verify that the app is signed, the following command provides information about the signing status of the app:

To check whether an application can be launched when Gatekeeper is enabled, use the spctl command:

If you leave off the --verbose tag, and it does not print any output, indicates 'success'.

MacMacJava Application For Mac Os X

For more information, see Distributing Outside the Mac App Store on

Submitting an App to the Mac App Store

Packaging an app for the Mac App Store is similar to packaging for regular distribution up until the step of signing the app. Signing the app for the Mac App Store requires a few more steps, and a different kind of certificate.

You will need to create an application ID and then obtain a distribution certificate for that application ID. Submit your app using Application Loader. For more information, see the following links (on

Free Application For Mac

Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved.