I'm having trouble using eclipse/intelliJ because whenever I try to check java version, this is what I will get. But java is present in the system preferences pane.
$ java -version
Unable to locate an executable at "/usr/libexec/java_home/bin/java" (-1)
If you're on Mac, do this:
export JAVA_HOME=$(/usr/libexec/java_home)
or:
export JAVA_HOME=`/usr/libexec/java_home`
Instead of this:
export JAVA_HOME=/usr/libexec/java_home
or:
export JAVA_HOME="/usr/libexec/java_home"
Looks like java is installed but classpath is not set. please try following command in terminal to set the java path.
export JAVA_HOME=/usr/libexec/java_home/bin/java
export PATH=$JAVA_HOME/bin:$PATH
Once this is done then check the java version. Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With