How To Install JDK 7 On El Capitan (10.11)

There are a number of applications on my Mac that need Java.  Some of them have to use older versions of Java.  Today I found an application that required a specific version of Java to be installed on my Mac.  The version of Java was 1.7.0_60-b19.  Ut Oh!  Yes, Ut Oh!  Java prior to version 1.7.0_67 had an issue installing on Yosemite and later.  These versions of Java treated Max OS X 10.10 or higher as as OS X 10.1.  This caused a bug where the OS version check failed and prevented you from installing Java.

Screen Shot 2015-06-17 at 3.34.34 PM

There are two ways to fix this problem that I know.  The first way is to modify the /System/Library/CoreServices/SystemVersion.plist file to spoof the version of OS X to 10.9.  Once modified you can then install Java.  Just remember to modify it back before you restart because you will be in a world of trouble.  Unfortunately this trick did not work on El Capitan.  The second way is to modify the Java package.  This is safer since you are not modifying system files.  Here are the steps.

  • Download JDK 7 Update 60 for Mac OS X
  • Open the .dmg file.
  • Expand the package file

   pkgutil –expand “/Volumes/JDK 7 Update 60/JDK 7 Update 60.pkg” “/tmp/JDK 7 Update 60.unpkg”

  • Open the Distribution file using TextEdit.

   open –a TextEdit Distribution

  • Find the function pm_install_check() and make sure it always returns true.
  • Take the expanded package files and repackage them.

   pkgutil –flatten “/tmp/JDK 7 Update 60.unpkg” “/tmp/JDK 7 Update 60.pkg”

  • Install using the new package.

   open “/tmp/JDK 7 Update 60.pkg”

The installer will run and skip the OS version check.  You should be able to install without any problems.