Sunday, August 2, 2009

Installing Java 6 on Mac OS Leopard 10.5.7





















I started with a Mac that did not have the latest JDK on it. Perhaps it did have the the JRE 5 Runtime on it. Not sure. And I need JDK SE 6 and the JRE 6 Runtime. And setting this up on the Mac is not as trivial as it is on Windows. (I realized this later)

As a first step, I tried to download the JDK 6 from Apple's ADC, I tried to run the Java Documentation .pkg file in the hope that I can read the instructions on it and proceed with the installation of the JDK and the Runtime. But the installer let me know that it cannot proceed until I had Java SE 6 on my system. So the realization was that before I even install the documentation package, I needed the SE installed. I guess we do things differently on Windows. Welcome to the world of the Mac. This is what I did to remedy things. I downloaded Java for Mac OS OS X 10.5 Update 5_9m3092.dmg (Disk Image). This download went into Macintosh HD/users/samantha/Downloads (this location is the default location for all downloads).
Now, how do you use a .dmg file? It turns out that according to this source, I inferred that dmg stands for disk image and a when a disk image file is clicked, an icon (in a separate windows) that represents the original folder/file is shown to you. In my case it was a .pkg file. Double Click on this .pkg file. In this case it was JavaForMacOSOSX10.5Update5.pkg. I think the StuffIt thing in the background decompressed the Disk Image File and pulled up the .pkg file for us. (not sure though)

Mac happily told me that it installed the JDK. But pray, where? During installation, the tool did not give you any option to install in a folder of your choice. So how am I know where javac for JDK 6 is.
After a few faltering steps, I looked at Nirav's tutorial and Nirav's pointer that JAVA_HOME for OSX is /Library/Java/Home. So I drilled down to this directory, and then pulled up the information for javac as shown in the screenshot below:
Well, the location of javac then is: /System/Library/Frameworks/javaVM.framework/Versions/1.5.0/Home/bin. This could not be my JDK 6 JAVA_HOME. It is the old JDK 5 JAVA_HOME. So I went down to the folder, /Versions and found a /1.6.0/Home/bin/javac" and then found a javac file there. This then is my JDK 6. My brand new JDK 6 JAVA_HOME should be /System/Library/Frameworks/javaVM.framework/Versions/1.6.0/Home/


All these steps were not very terribly obvious. But here are the steps anyways. Click on Macintosh HD on your Desktop. Then drill down to /applications/utilities/java Preferences (this is like an exe file. So when you click on it, the Java Preferences Window opens up as below)





Firefox tip:
I was looking to relaunch Firefox (and restore all the Windows that I had open before). I clicked on the Firefox icon on the Dock. This pulled up a little rectangular window with three buttons. I clicked the button that said "Open Web Page" and that restored all the pages that Firefox said it would restore.

Mystery: Where did JDK 6 install itself?

My next task:
Installing Oracle on my Mac:
See this post first: http://www.pythian.com/news/1937/quick-install-guide-for-oracle-10g-release-2-on-mac-os-x-leopard-intel

No comments:

Post a Comment