Install Oracle JDK without the installer on macOS

  • Download and mount the DMG for the JDK (in my case Java 8u291)
  • Copy the package file in a temp folder
  • Open a terminal and extract the package file in the temp folder:

pkgutil --expand JDK\ 8\ Update\ 291.pkg JDK8u291

  • cd into the extracted folder

cd JDK8u291

  • There is a jdk1.x.x_xxx.pkg file in the folder, but it's just a folder so open it

cd jdk1.8.0_291.pkg

  • Unarchive the file Payload with the archive utility open Payload or just use "Open with Archive Utility" in finder

  • Copy the Contents/home folder somewhere where you want your JDKs to be located

cp Contents/Home ~/Library/Java/JavaVirtualMachines/jdk8u291-oracle

And done :). No installer, no updater no changed environment.

Bonus: Install the JDK for use with SDKMAN!

sdk install java 8.0.291-oracle ~/Library/Java/JavaVirtualMachines/jdk8u291-oracle