Skip to content

How to resolve 'Unable to find any JVMs matching version' when opening a terminal window in MacOS

1. Purpose

In this post, I will demonstrate how to resolve the following error when opening a terminal window in MacOS:

Terminal window
Unable to find any JVMs matching version "1.6".

2. Environment

  • Mac OS 10.15
  • Java 1.8

3. The solution

3.1 What does this error mean?

Check the local Java installation by running the following command:

Terminal window
$ java --version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

This error indicates that the system expects Java 1.6 to be installed, but it is not present.

3.2 Solution #1

Install the specified Java version for your system (choose one of the following commands):

Terminal
brew tap caskroom/versions
brew cask install java6 # for jdk6
brew cask install java7 # for jdk7
brew cask install java8 # for jdk8

3.3 Solution #2

If you prefer not to install the specified Java version, you can remove all references to it from the following files:

~/.bash_profile
~/.zshrc
/etc/profile

In my case, I removed the following references:

~/.bash_profile
#export JAVA_6_HOME=$(/usr/libexec/java_home -v1.6)
#alias java6='export JAVA_HOME=$JAVA_6_HOME'

After making these changes, restart the terminal, and the warning message should disappear.

Terminal
Last login: Fri May 7 17:24:20 on ttys002
You have mail.
~

Now it works!

4. Summary

In this post, I demonstrated how to resolve the ‘Unable to find any JVMs matching version’ error when opening a terminal window in MacOS. The error occurs when the system expects a specific Java version that is not installed. You can resolve this issue by either installing the required Java version or removing references to it in system configuration files. Both methods are effective, and the choice depends on your specific needs.

Final Words + More Resources

My intention with this article was to help others who might be considering solving such a problem. So I hope that’s been the case here. If you still have any questions, don’t hesitate to ask me by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!