Since Apple removed Java 1.5 and Java 1.4 from Snow Leopard, it’s not possible to run software that requires older Java versions, or to develop against older Java versions.

In order to restore Java 1.4 and 1.5 to your Snow Leopard install, you’ll need to download the old Leopard versions and put them back where they belong in Snow Leopard. This will only work for Intel Macs.

You’ll need to use the Terminal in order to install one or both of the older Java versions. To get started, open up the Terminal and type the commands as shown. You don’t need to install both versions. The instructions for each are independent.

To install Java 1.5 First get the Java 1.5 archive and expand it.

cd /tmp/
tar -zxvf java.1.5.0-leopard.tar.gz

Then move it to the standard macOS Java location.

sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard

And finally, setup all of the links required for macOS.

cd /System/Library/Frameworks/JavaVM.framework/Versions/
sudo rm 1.5.0
sudo ln -s 1.5.0-leopard 1.5.0
sudo ln -s 1.5.0-leopard 1.5

To install Java 1.4 Get the Java 1.4 archive and expand it.

cd /tmp/
tar -zxvf java.1.4.2-leopard.tar.gz

Then move it to the standard macOS Java location.

sudo mv 1.4.2 /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2-leopard

And setup all of the links required for macOS.

cd /System/Library/Frameworks/JavaVM.framework/Versions/
sudo ln -s 1.4.2-leopard 1.4.2
sudo ln -s 1.4.2-leopard 1.4

After installation After you’ve installed one or both of the Java versions you can change the default Java used by macOS.
This step isn’t necessary unless you need to force macOS to use one of the versions you’ve just installed.

If you do want to change the default Java version used by macOS, open up the Java Preferences utility located in /Applications/Utilities.

Java Preferences

You can drag and drop Java versions in the bottom pane to change the order in which they are used.
The top version is the default version used by macOS. Make your change in the bottom pane - this is the JRE used when launching Java applications. The top pane selects the JRE used for browser applets.

Update: There have been numerous reports about Java applications breaking on Snow Leopard after installing these earlier versions. Install them at your own risk. However, this breakage appears to be for GUI applications. If you’re running command-line applications or simply using the JDKs to compile against, there shouldn’t be any issues. For GUI applications it’s buyer beware. If you do run into issues simply remove the older installed versions and restore the links.

BTW, I’ve seem multiple people state that there is never a reason to need these earlier versions. That’s simply incorrect. There are Java applications that refuse to run against newer Java JDKs or that fail to run correctly against newer JDKs. And if you develop Java, this is the only way (short of using a VM) to compile against earlier versions.

  1. These instructions are copied almost verbatim from OneSwarm. I only added a few steps and self-hosted the Java downloads.

  2. Instructions for an alternative approach are provided by Chris Snyder. This only works for Java 1.5, but it obtains the Java binaries directly from Apple.