If you run into problems during the installation of Java, it’s because Apple has added an extra layer of security to Macs known as Rootless SIP. Java Installation Problems in El Capitan, Sierra & High Sierra
If you find that you already have Java 1.6 installed, scroll down below “How to update Java 6 in El Capitan” as you also need to install a special update from Apple. If Java is on your Mac, you’ll see a message saying something like “Java (TM) Runtime Environment” in this case version 1.6 (or Java 6 as it is commonly known). If you’re not sure whether Java is installed on your Mac, simply search for Terminal in Spotlight and type: java -version at the command prompt. If you’ve never installed Java on Mac, then you can simply download and install the latest version of Java from Oracle which is known as Java 8 but rather confusingly officially called Java 1.8 by Oracle. It’s because an application you have installed or a website you’re trying to access requires Java to launch or work properly. To use the “java” command line tool you need to install a Java SDK