2011.07.21 17:10 MDT
UPDATE: If you're here because you want to run Zend Studio 5.x in Lion, I have a better solution for you.
Go to Zend Studio 5.x for OS X Lion (Java SE 6).
There's lots of information on the internet about getting a Java 1.5 JRE running in Snow Leopard, but if you update to OS X Lion you have to jump thru a few more hoops make it work. Much of the unchanged Snow Leopard instructions below were borrowed from chxo internets. Here's what you need to do to make it all work in OS X Lion:
UPDATE: Brice Dutheil has created a very cool bash script that will perform all these steps for you. I haven't tried it personally but a quick sanity check of the code makes me think it would work as advertised. There's also some useful tricks in there, like mounting the dmg then extracting the pkg and payload data from the command line. All you isn't-there-just-something-I-could-run-that-would-just-do-it-all-for-me types should all be sending Brice your extra Amazon promo codes or something. However, those of you who like to get your figers dirty, read on...
UPDATE: I've had one report that in step 18 the /System/Library/Java/JavaVirtualMachines directory did not exist in their Lion install, but /Library/Java/JavaVirtualMachines did. According to the report, using that direcory still resulted in a successful Java 1.5 VM. It wasn't specified whether theirs was a fresh Lion install or an upgrade from Snow Leopard nor was it specified whether the default Java SE 6 for Lion was installed. I have both directories, but the the 1.6.0.jdk is in the System JVM directory. Thanks to Dakshinamurthy Karra.

$ sudo -s# cd /System/Library/Frameworks/JavaVM.framework/Versions# pwd
/System/Library/Frameworks/JavaVM.framework/Versions
# rm -i 1.5
remove 1.5? y
# rm -i 1.5.0
remove 1.5.0? y
# pwd
/System/Library/Frameworks/JavaVM.framework/Versions
# mv -v 1.5.0 1.5.0_30
1.5.0 -> 1.5.0_30# pwd
/System/Library/Frameworks/JavaVM.framework/Versions
# ln -sivh ./1.5.0_30 1.5
1.5 -> ./1.5.0_30
# ln -sivh ./1.5.0_30 1.5.0
1.5.0 -> ./1.5.0_30
# ls -Fld 1.5*
lrwxr-xr-x 1 root wheel 10 Jul 21 14:28 1.5@ -> ./1.5.0_30
lrwxr-xr-x 1 root wheel 10 Jul 21 14:29 1.5.0@ -> ./1.5.0_30
drwxr-xr-x 9 root wheel 306 Jul 21 14:26 1.5.0_30/# cd 1.5.0_30
# pwd
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30
# vi ./Resources/Info.plist<key>JVMMaximumFrameworkVersion</key>
<string>14.*.*</string><key>JVMMaximumSystemVersion</key>
<string>10.7.*</string><plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>libjava.jnilib</string>
# pwd
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30
# ln -siv ./Resources/Info.plist .
./Info.plist -> ./Resources/Info.plist
# ls -Fl Info.plist
lrwxr-xr-x 1 root wheel 22 Jul 21 14:01 Info.plist@ -> ./Resources/Info.plist# pwd
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30
# mkdir -v ./MacOS
mkdir: created directory 'MacOS'
# cd ./MacOS# pwd
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30/MacOS
# ln -siv ../Libraries/libjava.jnilib .
./libjava.jnilib -> ../Libraries/libjava.jnilib
# ls -Fl libjava.jnilib
lrwxr-xr-x 1 root wheel 27 Jul 21 14:11 libjava.jnilib@ -> ../Libraries/libjava.jnilib# cd /System/Library/Java/JavaVirtualMachines
# pwd
/System/Library/Java/JavaVirtualMachines
# mkdir -v 1.5.0
mkdir: created directory '1.5.0'
# ls -Fl
drwxr-xr-x 2 root wheel 68 Jul 21 14:40 1.5.0/
drwxr-xr-x 3 root wheel 102 Jun 29 00:26 1.6.0.jdk/# cd 1.5.0
# pwd
/System/Library/Java/JavaVirtualMachines/1.5.0
# ln -sivh /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30 ./Contents
./Contents -> /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30
# ls -Fl
lrwxr-xr-x 1 root wheel 61 Jul 21 16:40 Contents@ -> /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30
Questions or comments to blog [at] s [hyphen] seven [dot] net.