What You See Is What You Get Element

Thank you for installing Oracle’s JDK 7 for Mac.

This release of the JDK is a developer-only version. You can use it to create Java applications and includes the new JavaFX 2.2 client stack.

The developer version however does not include a plugin to launch Java applications from the browser so applet and Web Start applications cannot use this JDK.

To test if the JDK installed successfully you should do the following:

note: if you are installing JDK 7u5 the version listed will be 1.7.0_05 instead of 1.7.0_04

  1. Switch to the Finder.
  2. Choose Go -> Go To Folder... or type command-shift-G.
  3. Type /Applications/Utilities into the dialog box. Click the Go button.
  4. Find Java Preferences.app in the window and double-click it. You should see a window that looks like this:

  5. You should see a JDK named 'Java 7 SE', with version 1.7.0_04. Click and drag it to the top of the list.

  6. Now, find Terminal.app in the window and double-click it.
  7. Terminal.app opens. If a window does not open, choose Shell -> New Window -> <Default>
  8. At the command prompt type:

    java -version

    and confirm you are running JDK 1.7.0_04.

    java version "1.7.0_04"
    Java(TM) SE Runtime Environment (build 1.7.0_04-bxx)
    Java HotSpot(TM) 64-Bit Server VM (build 23.0-b17, mixed mode)

Next Steps:


To use this JDK with Netbeans, you need to add it as a platform in the Java Platform Manager

  1. Launch NetBeans.app
  2. Choose Tools -> Java Platforms
  3. Click the Add Platform... button
  4. Navigate to the JDK's folder. Type "/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents" in the File field.
  5. The directory chooser should show Home and MacOS, and Home should have an icon on it indicating it is a Java home directory.
  6. Select the Home directory, and click Next.
  7. If you want, assign a new name to the JDK. Click Finish.
  8. Now, create a new project. For this verification, select "Java Application"
  9. Accept all of the default settings, and click Finish.
  10. Next, right-click on the project name and choose Properties.
  11. In the Categories list, choose Libraries.
  12. Next to Java Platforms, choose "JDK 1.7" (or the name of the JDK you entered earlier) from the popup.
  13. If you want to use Java 7 language features, do the following:
    • From the Categories list, choose Sources
    • In the Source/Binary Format field choose "JDK 7".
  14. Click OK.
  15. Now, let's make sure the new JDK is being used to run your code. Open "JavaApplication.java", and look for the main method.
  16. Type or copy this line of code into Main.java

  17. Save the file and from the main menu, choose Run -> Run Main Project.
  18. Verify that 1.7.0_04 is sent to the Output pane.

http://netbeans.org/kb/docs/java/quickstart.html will also help you get started with using NetBeans.

To use this JDK with Eclipse

  1. Launch Eclipse.app
  2. Choose Eclipse -> Preferences
  3. Choose Java -> Installed JREs
  4. Click the "Add..." button
  5. Choose "MacOS X VM" as the JRE type. Press Next.
  6. In the "JRE Home:" field, type "/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home"
  7. You should see the system libraries in the list titled "JRE system libraries:"

  8. Give the JRE a name. The recommended name is “JDK 1.7”. Click Finish.
  9. Check the checkbox next to the JRE entry you just created. This will cause Eclipse to use it as the default JRE for all new Java projects. Click OK.

  10. Now, create a new project. For this verification, from the menu, select File -> New -> Java Project.
  11. In the dialog that appears, enter a new name for your project. For this verification, type Test17Project
  12. In the JRE section of the dialog, select "Use default JRE (currently JDK 1.7)".
  13. Click Finish.
  14. Now, create a Java class to run. From the menu, select File -> New -> Class.
  15. Name the class Java17Test. Click the checkbox to create a stub for 'public static void main(String[] args)'
  16. Click Finish.
  17. Type or copy this line of code into Java17Test.java

  18. Save the file and from the main menu, choose Run -> Run.
  19. Verify that 1.7.0_04 is sent to the Console pane.

To use this JDK with IntelliJ IDEA 11 CE

  1. Launch IntelliJ IDEA 11 CE.app
  2. You should see the welcome screen with a number of options. Choose "Create New Project" from the QuickStart panel.
  3. Choose "Create project from scratch". Click Next.
  4. Provide a name for the project. Click Next.
  5. Keep the default source directory. Click Next.
  6. Your next step depends on whether or not you have run IDEA before. If not, follow these steps:
    1. The Project SDK window appears. Click on the ‘Configure’ button on the right side.
    2. Navigate to "/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home". Click Choose
    3. In the Project SDK window, you should see "1.7 (java version "1.7.0_04")" listed. Click Next.
    4. Leave the default settings on the next page. Click Finish.
    5. You are now ready to use Java 7 for your development.
  7. If you had already been using IDEA you need to add JDK 1.7 and select it for the project.
    1. Press F4 to bring up the Project Settings window.
    2. In the left column, choose ‘SDKs’.
    3. At the top of the second column, click the + icon. From the popup that appears, choose ‘JSDK’.
    4. Navigate to "/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home”. Click Choose.
    5. IDEA will name the SDK ‘1.7’. Verify that the Project Structure window looks like this.
    6. Click OK. You are now ready to use Java 7 for your development.
  8. You should see your project name listed in the top left. Double-click on it to expand it.
  9. Right-click on the blue "src" folder and choose New -> Java Class.
  10. The 'Create New Class' dialog appears. Type "Java17Test" into the field labelled 'Name:' and click OK.
  11. Type or copy this block of code inside the Java17Test class in the Java17Test.java file:

    public static void main(String[] args) {
  12. Save the file and from the main menu, choose Run -> Run 'Java17Test'.
  13. Verify that 1.7.0_04 is sent to the Run Java17Test pane.

To run a standard java program –including JavaFX programs- do the following

  1. Make sure you followed the steps above to ensure that JDK 1.7.0 is installed correctly.
  2. Locate the JAR file you want to run.
  3. Type

    java -jar <path to JAR file>

Alternatively, if you know that the JAR file can be run using java -jar, locate the file in the Finder and double-click it. The application should start normally.

If you would like to use Java from your browser or through a webstart application you will need to wait for the consumer release on Mac. There is an early access preview available. We encourage you to try it and give us feedback so we can deliver the best possible experience for Mac users when we release the JRE for Mac.

Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve