Our help desk already installed Java 1.8_151 on our macbook pro Mohave. When I type 'which java' I get the reply as /usr/bin/java
So, I added these two lines in my .bash_profile file in my home folder /Users/pnutalap
export JAVA_HOME=/usr/bin/java
export PATH=$JAVA_HOME/bin:$PATH
When I checked immediately 'java -version' I got back the java version correctly. But today, I am getting totally different resonse like...
N201960-MAC:~ pnutalap$ java -v Unable to locate an executable at "/usr/bin/java/bin/java" (-1)
Why there is additional /java at the end ? What has gone wrong ? And how to correct it to show java version properly ?