So I use InstaDMG to build my Mac OS X images for work. I got reports of Java being broken in my latest image. On looking at the problem the machines were at Java 1.5.0_13 when they should have been at 1.5.0_16. Reinstalling Java Update 2 and Java Update 3 didn't bring the machines to 1.5.0_16 like it should have. Also the Java apps in /Applications/Utilities/ are broken.
What I found was that Java Update 3 for Mac OS X 10.5 is not a cumulative update even though it doesn't check if Update 2 is installed, and installing Update 3 first makes you stuck on Java 1.5.0_13. To get around this I first added Java Update 2 to my InstaDMG process, but then I hit any afflicted machines with this script...
The "Payload" is the payload file from Java Update 2 which you can easily get by using pkgutil --expand to expand the Java 2 update PKG and copy out the Payload. Put the Payload file in the same directory as the script below.
echo "Fixing Java issue"
echo "Unpacking Java Update 2.."
ditto -x ./Payload /
echo "Installing Java Update 3.."
installer -pkg ./JavaForMacOSX10.5Update3.pkg -target /
echo "Finished Patch"
You should see if you made the same mistake as me that now your machine is running Java 1.5.0_16 and is happy again.