Install Java JDK7 on Mac OSX Snow Leopard 10.6.8

1. Download the latest JDK 7 from the Oracle web site.  jdk-7u21-macosx-x64.dmg

2. I ran and mounted the JDK 7 dmg file.  A volume appeared on my desktop called JDK 7 Update 21.

3. I extracted the contents of the installer using a program called Pacifist which I downloaded from charlessoft.com to a folder I created on the desktop.  You have to first click on Open Package within Pacifist and then load the JDK 7 Update 21 / JDK 7 Update 21.pkg package.  Once you load the package, select all the contents and drag it into a folder on the desktop.

4. At this point, you'll want to navigate to the JavaVirtualMachines directory located at [hd] / System / Lbrary / Java / JavaVirtualMachines.  You'll probably see 1.6.0.jdk package already listed.  Copy this file to the desktop and rename it to 1.7.0.jdk.  Now delete the contents within the 1.7.0.jdk package.  

5. Open  the directory where you extracted the installer contents to on the desktop.  You'll see 2 folders: JDK 7 Update 21 Folder and JDK 7 Update 21 Folder-1.  

6. Navigate to JDK 7 Update 21 Folder / Contents Directory.  There is a file called Info.plist and 2 folders called Home and MacOS.  Drag these into the 1.7.0.jdk package.

7.  Now open the JDK 7 Update 21 Folder-1 / Contents directory and drag everything into the package as well.  You do not need to replace any files or folders that already exist.

8.  Now drag the modified 1.7.0.jdk package into System / Library / Java / JavaVirtualMachines directory and double click to open it.  You should see the java preferences dialog at this point which should now list Java SE 7 as an option.  Drag it to the top and close.

If you are using NetBeans and started a project in 1.6 and continuing it in 1.7, you may need to change the Source/Binary Format located under Sources in the Project Properties.  You should see a drop down that lists JDK 6.  You need to change this to JDK 7.

When you open a Netbeans project or create a new one, you should notice the 1.7 library already loaded.  I ran the following to make sure it worked correctly:
public static void main(String[] args) {
     System.out.println(System.getProperty("java.version"));
}
and the following displayed in the console:
run:
1.7.0_21 


24 comments :

Juan Carlos said...

Hey Mate. You saved my life, thanks!!

Trev said...

Thank you so much for sharing... wew thought I needed to upgrade my iMac from Snow Leopard to Mountain Lion. Yey! :)

DanubeQuants said...
This comment has been removed by the author.
DanubeQuants said...

How can I make my command line java to be the updated one? (I'm not a programmer, just want to use java7 for a simple task.)

Miguel Perez said...

I only have 1 folder JDK 7 Update 21 and it contains the folders jdk17025 and javaappletplugin the jdk17025 does have the macos home and info.plist but the javaappletplugin folder has info.plist disabled.plist enabled.plist frameworks home macos plugins and resources lpease help

Miguel Perez said...

opps its not called JDK 7 Update 21 its JDK 7 Update 25

flyin23 said...

Thanks for the detailed steps. One change in step 6 is to create Contents folder in 1.7.0.jdk package and then drag the files there. After doing this I was able to see jdk 1.7 in the java preferences panel.

Bruce Lu said...

How to open the 1.7.0.jdk package for deleting the contents? double click does not work.

Niksa Jakovljevic aka Ksha said...

The above did not work for me so I might came up with an easier way of doing this. You can check it on my blog : http://jksha.blogspot.se/

Cheers,

Niksa

Maggie said...

Thank you!!

Jon S said...

Thank you! This was an easy setup!

Isaac said...

Hi there!!!

I'm trying to follow your great tutorial, but I miss in the step 4. Have I to delete the contents using Pacifist?? I can't find the way to do that...
Thanks in advance.

Elle said...

Hi Isaac, I was having the same problem.

You do not need Pacifist to do this step, in fact I don't think you can delete content using the program.

What you do is right click the jdk file on the desktop and select 'Show package contents'.

From there you delete the items within the Contents folder.

Hope this helped :)

Isaac said...

I Elle,

Thanks a lot for your help. I was a little bit lose...
I'll do in that way :)

Thanks again!!

Isaac.

Abdellah said...
This comment has been removed by the author.
Abdellah said...

Step 8, when I double click the 1.70jdk, its says "cannot luanch "java Preferences". No compatible version of java 1.5+ plus available"

I did everything right ...
using mac os x 10.6.8
the update folder i get is called "JDK 7 Update 51"
that's the only difference i have

Alex Bushatz said...

FInally worked. Had to make a few changes.

Make sure to use update 25 or older. 51 did not work for me.

And make sure to add the Contents folder and move stated files to it instead of the main folder.

Other than that worked perfect.

Thank you.

Lee Grey said...

I wasted a couple of hours and a lot of bandwidth downloading multiple versions, looking for a JDK installer that contained a Folder and a Folder-1. You will not see those names until AFTER you've used Pacifist to copy the contents of the installer pkg. Before you do the copy, you'll see jdk#####.pkg and javaappletplugin.pkg.

Erica J Dohring said...

I still only see 6 as an option after going through this whole process when I open up Java 7. Sad face.

Luan Nguyen said...

Thank you very much. Worked for me with below changes
step 4. delete the Contents folder
step 6. Navigate to JDK 7 Update 21 Folder and drag the Contents folder into the 1.7.0.jdk package
step 7. open the JDK 7 Update 21 Folder-1 / Contents directory and drag everything into the Contents folder of the 1.7.0.jdk package. Select don't replace for all.


Marcus Vinícius Mendes Gonçalves said...

i have a problem, "You'll probably see 1.6.0.jdk package already listed", JavaVirtualMachines folder is empty!

Thank you so much for your help! :)

Marcus Vinícius Mendes Gonçalves said...

My installation was corrupted, i reinstalled with this link: http://support.apple.com/kb/DL1573 ;)

pgflrob said...

This method no longer works. For one thing the folder JavaVirtualMachines is not in /System/Library/Java. In fact it is gone. Not sure how or why.
But I have java.

RobsiMac:~ rob$ java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
RobsiMac:~ rob$ echo $JAVA_HOME
/Library/Java/Home

It's Snow Leopard
RobsiMac:~ rob$ sw_vers -productVersion
10.6.8

What is JAVA_HOME
RobsiMac:~ rob$ ls -la /Library/Java/Home
lrwxr-xr-x 1 root admin 48 Oct 23 11:11 /Library/Java/Home -> /System/Library/Frameworks/JavaVM.framework/Home
RobsiMac:~ rob$ cd /Library/Java/Home
RobsiMac:Home rob$ ls
bin bundle include lib man
RobsiMac:Home rob$ ls -la
total 16
drwxr-xr-x 7 root wheel 238 Oct 23 11:11 .
drwxr-xr-x 10 root wheel 340 Oct 10 2013 ..
drwxr-xr-x 41 root wheel 1394 Oct 23 11:11 bin
lrwxr-xr-x 1 root wheel 3 Oct 23 11:11 bundle -> ../
lrwxr-xr-x 1 root wheel 51 Oct 23 11:11 include -> /System/Library/Frameworks/JavaVM.framework/Headers
drwxr-xr-x 41 root wheel 1394 Oct 23 11:11 lib
drwxr-xr-x 41 root wheel 1394 Oct 10 2013 man
RobsiMac:Home rob$

Where the heck is the java 6 sdk?

Sohail Akbar said...

Unlocking software tool