Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use Java 1.8

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)
like image 803
bengalurean Avatar asked Dec 15 '25 20:12

bengalurean


2 Answers

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"
like image 152
Paul Razvan Berg Avatar answered Dec 17 '25 09:12

Paul Razvan Berg


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.

like image 24
Vaibhav Jain Avatar answered Dec 17 '25 09:12

Vaibhav Jain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!