Java 1.5 by default from the command line on a Mac
Maybe someone else will find this useful, it was sure a head-scrater for me for a while. The good ol' Mac with its "oh, we have to have a non-standard UNIX file layout" was giving me quite a puzzler on how you are supposed to set your preferences for what version of Java to run from a command line. If you have the Java 5.0 Release 1 from Apple it comes with a little utility which lets you decide what order to use the JVMs on your machine. Setting it to use 5.0 before 1.4.2 does not affect items run from Terminal or any other command line application. Thanks for nothing Apple.
So to make this work (maybe this is intuitive for some people, but I'm not a big Mac developer or anything). Create or update the .profile in your home directory with the following:
PATH=.:/System/Library/Frameworks/JavaVM.framework/
Versions/1.5/Commands:$PATH
JAVA_HOME:/System/Library/Frameworks/JavaVM.framework/
Versions/1.5/Home
Presto! Anything you run from the command line goes via Java 5, or 1.5 or whatever the hell they are calling it these days. Simple, easy, and doesn't involve messing with any system links which some people seem to think is evil for some reason or another.
Hopefully one of these days Apple switches all machines over to run Java 5 by default. Sure would be nice for those of us who run Tomcat 5.5 and don't want to mess with the Java 1.4 compatability library.
1 Comments:
Brian,
You should submit this to macosxhints.com so that other java developers on osx can enjoy.
paul
Wednesday, February 08, 2006
Post a Comment
<< Home