I am getting the following error when trying to launch Android Device Monitor from the Tools window in Android Studio on a Mac.
and when I open the log file
Android Studio comes with built-in Java 1.8, so it wasn't a problem when you are developing android app. But when you launch Android Device Monitor, it uses external java compiler that run on your OS. If you have preinstalled Java before, it won't be a problem. Otherwise, you will face the same problem.
I tried to set JAVA_HOME path to java packed in Android Studio. It does not work, probably because it is openjdk version.
My solution was to download Java JDK 1.8 from Oracle and install in my computer.