September 19, 2005

Java Environment Setting in Mac

Defualt built-in Java in Mac is version 1.4, but I need to use Java J2SE 5.0 (version 1.5). Had a CS friend help this afternoon, I can run Java written in v1.5 properly now!!! :) (Make sure your machine update Java to 1.5)

Here is the solution:
1. In home directory, create a file called .profile
2. type command line below in the file:
export PATH=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands:$PATH
3. source .profile
4. check Java version (java -version)
5. start programming!!! :D


OR do soft link for the whole system:

1. Use terminal and go to the directory below:
cd /System/Library/Frameworks/JavaVM.framework/Versions

2. Remove the old 1.4.2 default link:
rm CurrentJDK

3. Re-create a new CurrentJDK linking to 1.5.0:
ln -s 1.5.0 CurrentJDK

(remember to change to root to do the commands - sudo command)

1 comment:

onecent said...

OR do soft link for the whole system:

1. Use terminal and go to the directory below:
cd /System/Library/Frameworks/JavaVM.framework/Versions

2. Remove the old 1.4.2 default link:
rm CurrentJDK

3. Re-create a new CurrentJDK linking to 1.5.0:
ln -s 1.5.0 CurrentJDK

(remember to change to root to do the commands - sudo command)