A month a so a go I wrote this item about java 6 on the mac. It was a beta release an I had some issues with it, but it was workable. Now the real deal is ready to be installed. You can download it form the following url.
http://www.apple.com/downloads/macosx/apple/application_updates/javaformacosx105update1.html
Running the update gives you two extra options in the java preferences pane. Now you can choose for java 6 (64 bit) but you can also choose for java 5 (64 bit).
I changed my settings to java 6 in the preference pane and now a java -version results in this:
java version "1.6.0_05" Java(TM) SE Runtime Environment (build 1.6.0_05-b13-120) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_05-b13-52, mixed mode)
You still have to do the trick with the softlink, beware of the order of arguments. In my previous article I made an error. So the correct thing to do would be:
sudo rm CurrentJDK sudo ln -s 1.6 CurrentJDK
Now you are al set to start using java 6 on the mac. Have fun.
I do not think it is wise to start tomcat as root, you can also combine the standard apache and tomcat. That way you can supply all static content from apache and you do not need to do this using tomcat. That way tomcat can be running on port 8080.
I am developing web apps and I have to start tomcat under port 80. Therefore I need root rights. When the code is compiled with 1.6 and tomcat starts in a 1.5 environment it is not working. Of course I can change the compile version to 1.5. But actually I don´t want to do that.
To make eclipse run with the settings changed to 1.6, you might have to modify the Info.plist in eclipse.app.
uncoment or add:
-vm/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java
Then eclipse should start again.
Hi,
I did all the steps and it works. Except for the root user. When I enter
“sudo java -version” in the terminal I get the following Message
java version “1.5.0_16”
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
Any ideas how to change the java version for the root user?
Thanks
René
In this folder : /System/Library/Frameworks/JavaVM.framework/Versions you can find all java versions. There are also a few special folders, the Current/CurrentJDK and the A. In the past I have changed these paths as well, but I ran into some problems with specific applications. Eclipse/Intellij that kind of apps. Therefore I switched them back. At the moment I have the same problem, can I ask why you want sudo rights to run something in Java?
Ej relaxed!
Helpfull article, Thanks.
I agree that command line you get the right version, but starting aplications like IntelliJ or other java tools use the currentJdk to start. So intelliJ will not use java 6. At least that is what I have found, maybe I am wrong, then please let me know.
Please don’t change the CurrentJDK symlink. The Java Preferences app in /Applications/Utilities/Java should switch the default java on the command line for you if you drag Java SE 6 to the top most entry.