How to fix "Java command-line tool" error messages

6 December 2016, 10:00

Feature head image

Recently people are reporting seeing a golden-oldie of a Mac error dialog. It reads:

To use the "java" command-line tool you need to install a JDK.

You might see this if you’re using the Facebook Video Calling app, an Runscape add-on app called OSBuddy, or indeed a variety of apps (some old versions of Adobe CS apps showed the error, for example).

What’s happening is that an app is trying to use the Java Runtime/Development Kit to run, and it isn’t installed. The error you’re seeing is one built into macOS/OS X that simply prompts you to install it.

While fixing the error is as simple as installing the software, it’s first absolutely necessary to make sure you system hasn’t got some malware that’s causing the error to appear. A depressing amount of malware uses Java to run.

To this end, as always I advise you run through a combo of:

Both are ultra-simple to use (undertake a deep scan when possible), so I won’t go into that here. I recommend both because you can run them when required, and they don’t stick around in the menu bar chewing-up system resources like other crappier antimalware apps.

Assuming no malware is found it’s necessary to make sure you know what apps are starting when you login. If there’s any you don’t recognize then you need to proceed with caution.

  1. Open System Preferences (it’s in the Applications listing within Finder) and click the Users & Groups icon. Then select the Login Items option. See anything you don’t think should be there? Select it and click the minus button beneath the listing, at the left. Note that the checkbox alongside each has nothing at all to do with whether that app runs or not. It’s merely there to set whether the app starts hidden.
  2. Click a blank spot on the desktop away from any icons, then hit the key combination of Shift+Cmd+G. Then paste the following into the dialog box that appears:
    And click Go.
  3. Here you’ll see listed files that kick-off various services when you login. Apps are identified usually by the developer that makes them, and by their name. For example, “at.obdev.littlesnitchd.plist” is the Little Snitch app, created by Obdev. It’s not an exact science but any that look trustworthy can stay there – those from Microsoft or Google, for example. If you see anything from Facebook, see this link for further instructions. Any you don’t recognise, or that are from old no-longer installed apps, you can remove in the usual way by dragging them to the Trash.
  4. Repeat the step above to search the following other folders for startup services, and again remove any you can’t identify or that are old:
  5. Reboot. If you still see the Java error message then continue to the steps below.

Here’s how to install Java, which will remove the message. Do not do this unless you’re absolutely sure a trusted app on your system requires Java. If you simply enable Java without knowing this, you’re likely to be enabling malware to run on your computer – which would be so dumb as to be eye-watering.

Head over to the Java website, then download and install Java. Reboot your computer. If the error still appears then it might be necessary to install the most recent – but still pretty old – version of Java that Apple released several years ago.

Leave a comment...

EtreCheck works well to scan and see what’s in those startup folders.

— Peter Gilbert · Dec 6, 12:46 PM · #