If your Mac keeps popping up the error “To use the “java” command-line tool you need to install a JDK”, and you keep thinking that you have installed it, but to no avail, you’re not alone. Here’s what you actually need to do to vanquish this beast.
You may have already searched for answers, finding such varied answers as “delete the cache and cookies on your browser” to “sacrifice a goat to the ghost of Steve Jobs”, but none of these things work (plus the goat doesn’t like it).
First, to understand what is causing the issue, one or more applications (you know…programs, in oldspeak) on your Mac are calling for Java and not finding it (or at least not recognizing it). This most often happens with Macs that have been updated or upgraded to a newer flavour of OS X 10 (usually Yosemite, El Capitan, Sierra, High Sierra, or Mojave; also known as OS X 10.10, 10.11, 10.12, 10.13 and 10.14, respectively) or that came with an OS X 10+ installed.
So, you think (reasonably enough) that the issue must be that your Java install isn’t updated (enough) for the new OS version.
And that’s where you’d be wrong.
Because in reality, what is happening is that the application or applications that are throwing the error are actually looking for an older, legacy version of Java, and not finding it! Specifically, it is looking for the legacy Java 6.
So, to fix the error, you need to download and install Java 6, also known for these purposes as Java for OS X 2015-001.
Fortunately, Apple has made this easy, as they recognize their screw-up in shipping apps that still rely on a deprecated (i.e. discontinued) version of Java.
Also fortunately, installing the older version does not seem to impact any programs relying on the newer version, at least in our experience.
To download this legacy version of Java, to fix the “To use the java command-line tool you need to install a JDK” error, go here:
At the top of the page at that link, you will see this:
Just click on ‘Download’, and you will have quickly fixed the issue.