logoDuke3DprogressionSmall.jpgWhen I bought my Mac a few months ago, there was some doubt about the support of apple for java. Java 6 was out for a while and Leopard was still shipped with java 5. There were a lot of blogs and a lot of reactions to the lag of support. For me it was not a real problem, java 5 was already a big step forward. Yes I was working for big corporations still doing IBM websphere 5.1. But since I have moved to JTeam (well oke, I am starting this week) I need java 6. I knew there was an opensource initiative to port java 6 to the mac. So I started googling for it. But I stumbled upon this site from apple: http://developer.apple.com/java/. There now is a developer release for java 6. I also started reading some other java related material for the mac. In this blog item I want to share some of the stuff I found. I do want to stress that most of the knowledge comes directly from the articles I have found on the mentioned website. I will try to give references if I can still find them.

read on for the tips.

Downloading java 6

Before you can download the software you need to become a member of the apple developer connection group. Go to the following url to download the java 6 developer preview 9.
http://developer.apple.com/java/download/
The downloaded package contains an installer for the java six library.

Learn about basic usage of java on Mac OSX Leopard

The best starting point for learning about java on Mac OSX Leopard is this link: http://developer.apple.com/java/javaleopard.html. The mac supports multiple version of java out of the box, after installing java 6 there are versions 3,4,5 and 6 available. You can find them in the following location:

/System/Library/Frameworks/JavaVM.framework/Versions
jettro:Versions jettro$ ls -al
total 56
drwxr-xr-x  14 root  wheel  476 Mar 29 12:20 .
drwxr-xr-x  11 root  wheel  374 Mar 18 19:41 ..
lrwxr-xr-x   1 root  wheel    5 Mar 18 19:41 1.3 -> 1.3.1
drwxr-xr-x   3 root  wheel  102 Sep 29  2007 1.3.1
lrwxr-xr-x   1 root  wheel    5 Nov  4 17:54 1.4 -> 1.4.2
lrwxr-xr-x   1 root  wheel    3 Mar 18 19:41 1.4.1 -> 1.4
drwxr-xr-x   8 root  wheel  272 Aug  5  2007 1.4.2
lrwxr-xr-x   1 root  wheel    5 Nov  4 17:54 1.5 -> 1.5.0
drwxr-xr-x   9 root  wheel  306 Mar 29 11:15 1.5.0
lrwxr-xr-x   1 root  wheel    5 Mar 18 19:41 1.6 -> 1.6.0
drwxr-xr-x  10 root  wheel  340 Mar 29 11:14 1.6.0
drwxr-xr-x   8 root  wheel  272 Mar 18 19:41 A
lrwxr-xr-x   1 root  wheel    1 Mar 18 19:41 Current -> A
lrwxr-xr-x   1 root  wheel    3 Mar 29 11:16 CurrentJDK -> 1.6

As you can see, there are a lot of different folders and soft links here to be found. For me the softlink CurrentJDK is pointing to a different location than the default. I changed it to 1.6. If you have absolute no knowledge of unix, then I recommend you learn or you be very careful. I removed the old virtual link and created a new one. You have to be the super user to be able to do this.

sudo rm CurrentJDK
sudo ln -s 1.6 CurrentJDK

By going up one folder you can get a general idea about the usage of java. The most important is the Home soft link. This is the one you can use as a Java home when you need it.

/System/Library/Frameworks/JavaVM.framework
jettro:JavaVM.framework jettro$ ls -al
total 64
drwxr-xr-x  11 root  wheel   374 Mar 18 19:41 .
drwxr-xr-x  84 root  wheel  2856 Nov  4 17:54 ..
lrwxr-xr-x   1 root  wheel    27 Mar 18 19:41 Classes -> Versions/CurrentJDK/Classes
lrwxr-xr-x   1 root  wheel    24 Nov  4 17:54 CodeResources -> Versions/A/CodeResources
lrwxr-xr-x   1 root  wheel    28 Mar 18 19:41 Commands -> Versions/CurrentJDK/Commands
lrwxr-xr-x   1 root  wheel    24 Mar 18 19:41 Headers -> Versions/Current/Headers
lrwxr-xr-x   1 root  wheel    24 Mar 18 19:41 Home -> Versions/CurrentJDK/Home
lrwxr-xr-x   1 root  wheel    23 Mar 18 19:41 JavaVM -> Versions/Current/JavaVM
lrwxr-xr-x   1 root  wheel    29 Mar 18 19:41 Libraries -> Versions/CurrentJDK/Libraries
lrwxr-xr-x   1 root  wheel    26 Mar 18 19:41 Resources -> Versions/Current/Resources
drwxr-xr-x  14 root  wheel   476 Mar 29 12:20 Versions

Now we made IntelliJ make use of java 6, cool stuff or not. To control the default java versions for applications, applets and java webstart apple has provided us a utility application. Go to /Applications/Utilities/Java Preferences. Using the following screen you can adjust the version of java used by applets and programs.

Screendump_mac_java_settings.png

Now you can check the version of java by opening a command prompt and typing java -version.

jettro:~ jettro$ java -version
java version "1.6.0_04-dp"
Java(TM) SE Runtime Environment (build 1.6.0_04-dp-b06-110)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_04-b12-45-optimized, mixed mode)

So nice java 6 on the mac, bye bye old stuff.

Java on apple’s Mac OSX
Tagged on: