JAVA_HOME on Mac OS X 10.5

I normally don’t mess with Java so this is likely a trivial point, I could very well be stating the most obvious of obvious things.

The documentation for Amazon’s EC2 Web Service actually had a well written explanation, but who reads? Scanning the setup instructions I saw:

  • Java. — Check, I got that
  • Java JRE version 1.5 — Check? [smbrown@jrcash$] java -version
  • JAVA_HOME — Check? [smbrown@jrcash$] which java
  • FAIL

JAVA_HOME is /Library/Java/Home it is the location where the sub folders bin/java/

What is my “JAVA_HOME“? it is “the full path of the directory that contains a sub-directory named bin which in turn contains the java

To see your current JAVA_HOME:
[smbrown@jrcash$] echo $JAVA_HOME

To set a JAVA_HOME, insert this in your ~/.profile:
JAVA_HOME=/Library/Java/Home
export JAVA_HOME;

What is a better way to confirm your real Java version JAVA_HOME on OS X?

[smbrown@jrcash$] $JAVA_HOME/bin/java -version

Thanks for taking a look you can go back to Twittering now. =)

Update (January 10, 2009): Amazon released their AWS Web Console, here’s an early tour.