How to fix 'To use the 'java' command-line tool you need to install a JDK' error
1 min read

How to fix 'To use the 'java' command-line tool you need to install a JDK' error

You do not need to install the official Oracle JDK.

You can solve the error "To use the “java” command-line tool you need to install a JDK. Click “More Info…” to visit the Java Developer Kit download website." on macOS, by installing a version of the JDK.

You do not need to install the official Oracle ones, you can install the AdoptOpenJDK ones by running

brew cask install adoptopenjdk

This will save you a preference panel in System Preference, and you can manage the installation with brew cask.

Subscribe to a curated newsletter

Receive an email every week with curated content about Dart and Flutter.

See previous issues of the newsletter.