Even though it worked for me, this fix has given a lot of people problems, so you probably shouldn’t try this. I leave this article online though, maybe it’s of use to someone as a starting point for further investigations. Thanks for all the hate mail though. Ah, the internet is so much fun!
OK, this one might also be widely known but it cost me a few minutes to figure it out, so here it goes: Software Update installs Java 1.6 on 64bit-capable Macs running Leopard. However, this doesn’t mean they change the default runtime version that gets called when you click on a jar file or call code directly from the command line.
OS X’s Java binaries live in a directory called “/System/Library/Frameworks/JavaVM.framework/Versions“. On a 64bit Mac this should contain quite a handful of different runtimes:
lrwxr-xr-x 1 root wheel 5 Apr 30 12:25 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 Jan 22 14:00 1.4 -> 1.4.2 lrwxr-xr-x 1 root wheel 3 Apr 30 12:25 1.4.1 -> 1.4 drwxr-xr-x 8 root wheel 272 Jan 22 14:00 1.4.2 lrwxr-xr-x 1 root wheel 5 Jan 22 14:00 1.5 -> 1.5.0 drwxr-xr-x 8 root wheel 272 Jan 22 14:00 1.5.0 lrwxr-xr-x 1 root wheel 5 Apr 30 12:25 1.6 -> 1.6.0 drwxr-xr-x 8 root wheel 272 Apr 30 12:25 1.6.0
This directory also houses two symlinks called “Current” and “CurrentJDK“. As root in Terminal, remove those and replace them with symlinks to the 1.6 runtime:
rm Current* ln -s 1.6.0/ Current ln -s 1.6.0/ CurrentJDK
There, all done! From now on “java -version” should return something like:
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)
Possibly Related Posts:
- Mac Neophyte Tips: FileVault on Removable Drives
- New InstaRPG Version Out
- Horrible Thread Memory Hole In Ruby
- Gmail Mobile Java App
- Throwing Up The Java Bile
More:
Mac Neophyte Tips: FileVault on Removable DrivesI’ll admit it: I’m a total Mac noob. Though I’ve...
I imagine they don’t change the default version because of compatibility issues, right? But even so, it seems kind of dumb – most Java devs switched to 1.6
I think they did it in order to NOT fragment the Leopard platform. Having to consider two Java versions for OS X (because older Macs can’t upgrade) would be even more of a bummer for Java developers. I guess Apple just opted in favor of a uniform software base for their OS which kind of makes sense.
Of course, not having the upgrade option for 32bit Macs at all is kind of silly in the first place…
I found that even if I did this, on restart it would drop back to the original default. Which seems to imply there’s another declaration of the java version somewhere else, which gets called on system startup.
Anyone know where that is?
UP, that hasn’t happened to me. I couldn’t find any reference to a process that might be responsible for doing that on start up, but it might be worth a try to move the older Java versions out of that directory to some other place (in case you need them later)…
Another way to set your default version is to use the Java Preferences tool in /Applications/Utilities/Java. You can easily swap the default version in the utilities’ GUI without root access which is required to change the links as described above.
Thanks kevin, you’re right. However, the Prefs App in Utilities won’t load on my MacBook for some reason – but it does on the Mac Pro… anyway, you’re right!
I did exactly the same, the terminal still shows as 1.6.0_07. I moved java 6 to the last, in the preferences pane too.
I can’t set the jvm version to 1.5.0. I think I’m gonna uninstall 6, its a shame
Hi
Please help. I followed your instructions, but now my Eclipse wont start. It returns Error Code=-1.
I tried to change back to version 1.5.0, using your instructions, but Eclipse still wont start. I also tried downloading Elipse again, same problem
Hi Tore, sorry to hear that. Have you tried changing it back? Try starting Eclipse from the command line to see what error messages it throws out!
How to use eclipse on mac with java 6:
http://blog.kischuk.com/2008/05/08/running-eclipse-on-macbooks-with-java-6/
having the same problem as tore HELP ANYone?!
Hey I had Tore’s problem, and I fixed it
instead of going back to version 1.5.0, just point to the folder “A”
I have the same problem as Tore. The author (Udo?) need to think before posting crap!