I don't actually use MacOS but, try your environmental variables.
If you don't get a version back when using the command: java -version
(without the quotes), the path to java probably isn't set right.
We can further check that this is the case by using the command: printenv
or env
to get a print out of all the variables that are pathed on your machine.
You can check to make sure your java is installed in the default location by using
/usr/libexec/java_home
Then you can add to the environmental variables list by:
- Find the path to .bash_profile by using:
~/.bash-profile
Open the .bash_profile file with a text editor of your choice.
Scroll down to the end of the .bash_profile file.
Use the export command to add new environment variables:
export [variable_name]=[variable_value]
The command should look something like this
export JAVA_HOME=$(/usr/libexec/java_home)
This is just a guess as I again don't use Mac or have access to one
Save any changes you made to the .bash_profile file.
Execute the new .bash_profile by either restarting the terminal window or using:
source ~/.bash-profile