How to use differente JDKs in IDEA on Mac OSX?

I have had to include a Mac as developing machine but I have one thing I am not sure how to solve under Mac...
I am used to just downloading JDK tar files and unpack theme to each own folders and include them as JDKs in IDEA. But I can not find a way to do this when using Mac; there is no JDKs to "install" and the only JDK I can include in IDEA is the JDK that Apple has decided I can have running on my Mac...

What am I missing? Is this not really possible?


Regards,

BTJ

0
7 comments

I'm not an expert on Mac OS, but Mac OS (at least 2 recent versions - 10.7 and 10.8) has JDK 1.6 installed by default and - AFAIK - it's provided only by Apple (you won't find it on Oracle/Sun website). No idea where to get previous version of JDK (1.4 and 1.5, my guess is: from Apple), but 1.7 installer (*.dmg file) can be downloaded from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/index.html

PS You're asking "how to use different JDKs in IDEA" in subject, but actually you're asking "how to install JDK on Mac OS" - and that's a question you should ask on Apple forum, cause it's not related to IntelliJ IDEA.

0

Yes, but I am used to using different versions of 1.6 and different versions of 1.7, etc... And I was hoping that someone had done the samething using Mac OSX...

BTJ

0

Then, nope - I haven't done that. In my production environment Mac is developer machine - means I have only one version of 1.6 and one version of 1.7, compilation, testing, etc. is done on a different machine with all required versions installed. About version 1.7 - you can download and install previous updates from Oracle (http://www.oracle.com/technetwork/java/archive-139210.html) and I guess installing those next to 1.7u7 shouldn't be a problem. Can't help you with 1.6 though - I  guess you should check Apple forum for that.

0

Oki, thx anyway... :)

BTJ

0

To get different Java 6 versions you will need to sign up for a developer account at Apple, I think they still do a free one, and download the Java developer packages. These will be installed into /Library/Java/JavaVirtualMachines, they don't have releases to match all the updates that you can get from Oracle so you may not get a specific update version.

Rod

0

Apple started their own Java port many years ago when Java on the desktop looked like the next wave. Sun wasn't willing/able to make a first class port for the Mac so Apple took it over. They ended up going their own way, creating a mechanism for faster loading, GUI bindings, etc. The upside was that for a while the Mac was the only platform that had decent native-looking GUI Java apps. The downside is that Apple was forever lagging behind Sun's releases. The end result is that the Java releases became tied to specific OS releases. If you can find a 1.3 release it probably won't start up on Mountain Lion. You can find old install packages for 1.4 and 1.5 (I have an old blog post about using them on Snow Leopard) but they don't install in the same locations any more.

The new locations are in one of two places:

- /Library/Java/JavaVirtualMachines/
- /System/Library/Java/JavaVirtualMachines/



And they aren't in the standard format of just unzipping a Java release.

You'll have to find the (unsupported) earlier releases and attempt to shoe-horn them into the new locations and keep your fingers crossed that they work for what you want (hopefully just command-line server stuff).

- http://tedwise.com/2009/09/25/using-java-1-5-and-java-1-4-on-snow-leopard/
0

I am on a Mac running Mountain Lion and I have 1.5, 1.6, and 1.7 installed and can use whichever one I need for a particular project (we have some apps on Weblogic 9.x which only runs under Java 1.5 so I need that to run Weblogi 9.x locally for debugging).

Java 1.6 and Java 1.7 are trivial to obtain and install. Mountain Lion will install 1.6 for you and you can get 1.7 from Oracle.

Java 1.5 is a little more difficult to find out how to install; however,  it turns out to be mostly trivial once you find what you need to do.

Go here and cut/paste this script into a file, give it execute permissions and run it. It will download and install Java 1.5 for you:

https://gist.github.com/1163008

After the script ran I did have to create the following symbolic link to make Java 1.6 work for me (the 1.5 install script seemed to remove this link which was there previously). In /System/Library/Frameworks/JavaVM.framework/Versions I had to create this:

CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents (so execute: sudo ln -s  /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents CurrentJDK)



Screen Shot 2012-09-05 at 8.59.19 AM.PNG

0

Please sign in to leave a comment.