Pretty new to Java and also to Mac ... I want to make sure JAVA_HOME is set so in other programs I can use its path. So I did some Googling and here is what I got:
I
The empty value of the echo command would mean that the value has not been set correctly as you are expecting. You can try creating/editing ~/.profile by adding the lines something like:
vi ~/.profile
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
if you are not yet comfortable with vi editor, you may also create that file in your home directory using TextEdit program in Mac. and execute
source ~/.profile
That will load set the JAVA_HOME property. Next you can try out executing echo $JAVA_HOME to check whether it has been set correctly as you expect.
You may also need to set PATH environment variable as something like:
export PATH=PATH:$JAVA_HOME/bin