If you currently have your JAVA_HOME environment variable set as the trusty:
export JAVA_HOME=/Library/Java/Home
then when you upgrade to Lion you will need to adjust it, as the install location has changed. The new environment variable should be:
export JAVA_HOME=$(/usr/libexec/java_home)
This is actually a command which (in true OS X Java fashion) is a symlink to another command that outputs the true location of Java. For example:
[iMac:~]$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home
Thanks so much! This got me back up and running after my upgrade.
Many thanks; I was wondering about this.
Turns out that depending on how you install the JDK, the /Library/Java/Home link still works. If you install it manually, you need to do as the article says, if you launch a Java command and install it via the prompt that comes up, the link in this comment works. Nice and consistent.
Thanks Steve, this worked well for me on Snow Leopard too. Seems to be a more robust approach.
Works for Mountain Lion too.