MacOS X Mountain Lion and Java 7 installation

MacOS X Mountain Lion and Java 7 installation

Today I set out to get Java 7 JDK running on MacOS X Mountain Lion (10.8.2). As Apple actually only installs Java 6 (1.6.x) one needs to get Java 7 from the Oracle website at the Java SE download site.

Once downloaded simply run the installer and it (should) install Java 7 properly on your system. After that, you can use the following command to make Java 7 the active version to use:

[code]/usr/libexec/java_home -v 1.7.0_11 –exec javac -version[/code]

Now, if you use “java -version” it should actually give the output that it used Java 7.

Troubleshooting

Now the above should all be according to the book, but as things are when it comes to Java they are never “click and go”. One of the problems, I’ve had was that no application on the terminal actually picked up the Java 7 JDK. Digging around a bit showed me that the installation created sym links in the “/System/Library/Frameworks/JavaVM.framework/Versions/” directory.

As it turns out the “CurrentJDK” linked to the “old” Java 6 (1.6) installation. So, in order to point it to Java 7 I’ve had to do the following:

[code]rm CurrentJDK
ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/ CurrentJDK[/code]

This immediately fixed the issue and all terminal applications worked again.

Note: I’ve had manually set the “JAVA_HOME” and “JRE_HOME” variables in the “.profile” file. With the above setting I’ve had to remove those variables in order to make it work!

Troubleshooting 2

I initially removed the Apple installed Java 6 (1.6) installation manually, I removed the directory /System/Library/Frameworks/JavaVM.framework and other Java references (yes, I know it is/was a bad idea). Just installing Java 7 did not help nor does a system reboot. Also, Apple updates did not recognise that Java was gone. Also, installing Java 6 from Apple directly (download img) did not help. In short, nothing worked anymore.

The only solution was to get Pacifist (look for it on the web). Within Pacifist load the PKG (from the Java 6 image) and install the complete package and overwrite all existing installation. This will replace all the files I accidentally removed (the important system files) and got it all up and running again.

Trusted by over 2,000 organizations with millions of emails

Helpmonks helps us answer customer emails at lighting speed
We couldn't do our job without Helpmonks!
Helpmonks, the best thing since sliced bread
Excellent option for collaborating email amongst your team
A good platform that is here to grow and help you grow
Helpmonks is a great tool that our company utilizes and depends on
Great shared inbox for the team
Fantastic email support service for any business
Easy to navigate and catalog data for specific users
Solid Helpdesk software w/ responsive customer support
A really good solution to manage customer support mailbox
Good support, useful features

One more thing...

Helpmonks gives you the ability tocollaborate as a groupin your shared mailbox, features aTeam To-Do App, powerfulCustomer Relationship Management (CRM)capabilities, a completeLive-Chat tool, a mighty Email Marketing Platform that includes sending ofemail campaignsandemail automation, collision detection, email tracking, reminders, mentions, custom fields, custom applications, customer satisfaction ratings, Single-Sign-On (SSO) & SAML authentication, Trello, Zapier, Slack, an API, and much more.

Check outthe complete feature listor sign up for afree 30-day shared inbox trial now