Friday, September 13, 2013

Java 7 and Snow Leopard (OSX 10.6... )

As said in the title I needed to install Java 7 on my OSX 10.6.8 aka Snow Leopard. Of course as usual I downloaded Java 7 JDK and run installation program and guess what, it did not work.I was getting a message saying that I need to have at least Lion version of OSX in order to run Java. I have know idea why is that but sounds pretty stupid.

So lets go straight to business and take look how I did it.

Navigate to /System/Library/CoreServices and edit SystemVersion.plist to change following properties:

ProductUserVisibleVersion = 10.7.8
ProductVersion = 10.7.8 

As you would guess above will change version of your OSX as seen by Installer. To be sure that you changes were applied open up About This Mac Window and check if it matches. Now installation should work without any problems.

After installation go to console and type in.

java -version

If Java version remained the same as it was before (in my case I had Java 6 )  you need to remove soft link :

/Library/Java /Home

and create new one with same name but pointing to newly installed Java which was in my case:

/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home

Hope this helps someone and don't forget to change back version in SystemVersion.plist!


UPDATE:

I forgot to mention one more important thing and that is to change softlink in /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK . That softlink should point as well to new JDK location.
Also in some cases (as noticed by Alejandro) you will need to update order of virtual machines on your computer: double click on /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk to load Java Preferences and change order of VMs.


Happy coding.

Niksa Jakovljevic