Sabya Sabya - 1 year ago 192
Java Question

Unable to locate an executable at "/usr/bin/java/bin/java" (-1)

I am having a pathetic issue with Java in my mac osx 10.7.3 .
Previously I installed it and it was working fine.
After some changes in the .bash_profile and .profile file in the course of time,
I am having an error like

Unable to locate an executable at "/usr/bin/java/bin/java"

whenever I try to run "javac" or "java" in my terminal .

echo $PATH
gives an output like :


My .bash_profile looks like :

alias start_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM start"
alias stop_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM stop"
export JAVA_HOME=/usr/bin/java

Output of
which java


Its bugging me for long days and uninstalling and installing java did not help my luck .

I am a newbie in Mac and need help to sort out this issue .

Googled and saw SOF before posting this question but did not find anything specific to my problem .



Answer Source

Most certainly, export JAVA_HOME=/usr/bin/java is the culprit. This env var should point to the JDK or JRE installation directory. Googling shows that the best option for MacOS X seems to be export JAVA_HOME=/Library/Java/Home.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download