How to install and configure JDK & JRE in macOS Sierra?

On my brand-new iMac Retina 5K 27" 2017 running macOS Sierra 10.12.6, I am not able to run Base. I have downloaded and installed the latest JDK for macOS (jdk-9_osx-x64_bin.dmg) from Oracle’s Java website. After doing so, I did not find a “jre” subfolder in /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/. In LibreOffice > Preferences > Advanced, I checked “Use a Java runtime environment”, but no JRE was listed below under “Vendor/Version/Features.”

I then downloaded the latest JRE for macOS (jre-9_osx-x64_bin.dmg) from Oracle’s website and ran that installer. Still no “jre” subfolder in /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/, where it should be, and still no JRE listed in LO > Preferences > Advanced. Apparently, Oracle’s installer installs the JRE to support Java applets in web browsers, but not to support applications.

Next, I downloaded jre-9_osx-x64_bin.tar.gz and uncompressed it. This yielded a folder named “jre-9.jre”. I copied this folder to /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/ and renamed it “jre”. In LO > Preferences > Advanced, I clicked “Add”, navigated to /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/jre/, and clicked OK. LibreOffice displayed this message:

The Java runtime environment you selected is not the required version.
Please select a different folder.

Would someone who knows how to install and configure Java on macOS Sierra please provide instructions on how to do this successfully?

Thanks,
BillLibre

I have the same problem but with macOS 10.13.3 on 15inch MacBook Pro

I have just the same problem with OsX 10.13.4 (High Sierra). Were you able to find a solution?

Now I’ve found out that you have to install the JDK Development also. Sorted it for me.