This took me too long to figure out, so I'm writing this up now.
To switch from Java 7 to Java 6 on Lion:
sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/Current
sudo ln -sf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents /System/Library/Frameworks/JavaVM.framework/Versions/Current
To switch from Java 6 to Java 7:
sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/Current
sudo ln -sf /System/Library/Frameworks/JavaVM.framework/Versions/A /System/Library/Frameworks/JavaVM.framework/Versions/Current
There's something deeply suspicious about this, but at least it works.
To switch from Java 7 to Java 6 on Lion:
sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/Current
sudo ln -sf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents /System/Library/Frameworks/JavaVM.framework/Versions/Current
To switch from Java 6 to Java 7:
sudo rm /System/Library/Frameworks/JavaVM.framework/Versions/Current
sudo ln -sf /System/Library/Frameworks/JavaVM.framework/Versions/A /System/Library/Frameworks/JavaVM.framework/Versions/Current
There's something deeply suspicious about this, but at least it works.