Cannot install JDK 7 on macOS Sierra 10.12.6

Solution 1:

Similar to what @klanomath suggests:

  1. Copy the pkg off the disk image so it can be edited.
  2. Extract pkg contents in Terminal (assumes "JDK 7 Update 67.pkg" is your pkg name): pkgutil --expand JDK\ 7\ Update\ 67.pkg JDK\ 7\ Update\ 67.unpkg
  3. Edit the Distribution file with your favorite text editor.
  4. Change the return value of pm_install_check() to always be true.
    function pm_install_check() {
      return true;
    }
  1. Save the Distribution file.
  2. Back in Terminal: pkgutil --flatten JDK\ 7\ Update\ 67.unpkg JDK\ 7\ Update\ 67.new.pkg
  3. Run/Open the new pkg file.

Solution 2:

The check is performed by the pm_install_check() function in the package's Distribution.

  1. Copy the pkg off the disk image so it can be edited
  2. Open it with The Archive Browser
  3. Edit the Distribution file with TextEdit (right-click on Distribution and choose Open With to edit the file in place).
  4. Remove the following lines so the function always returns true.

  5. Save the file and open the pkg.

Solution 3:

This is an obvious thing to happen, cause JDK 7 was made for previous versions of macOS. You need to use JDK 8 in order to successfully install it on your current macOS version. Check Here: Java SE Development Kit 8 Downloads