Java 1.6 on OS X

As a default java 1.5 is the enabled Java version on Mac OS X, however if you run an updated version of your OS X you can easily start using Java 1.6 instead – it is already there!  All there is to it is, that you need to enable it.

If you simply want to use Java 1.6 in your current terminal session, you can fire this command:

alias java=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java

From that point on, when you use your Terminal, Java 1.6 will be used.

Also, you can add that line to ~/.bash_login – well, at least if you are using bash, and then it will always be the java used when firing off “java” from the terminal.

And! You can change the link from /usr/java/bin to use the 1.6 version. Do this with these:

sudo rm /usr/bin/java
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java /usr/bin/java

Personally I use the alias method. That was it for now. Have fun with Java 1.6.

This entry was posted in Mac, Nerdy. Bookmark the permalink. Both comments and trackbacks are currently closed.

One Comment

  1. Alexander P
    Posted September 30, 2009 at 1:58 pm | Permalink

    Jeg stod og skulle bruge Java 1.6 på min MacBook for et år siden til min programmerings projekt på Universitetet. Jeg kan ikke huske om det er HashMap eller Stack der er ikke understøttet eller om det var noget andet. Men på det tidspunkt skulle man også først få fat i JSE 6.0 først. Og den gang det kunne man kun gøre ved at registrere sig som Apple Developer (som er dog gratis).
    Og når den var installeret, så kunne man nøjes med at angive det i Eclipse/NetBeans, til at bruge det til projekter. For i hverdagen havde ikke den største betydning.