Clinton Green
Clinton Green

Reputation: 9977

Mac Mavericks Java unable to locate executable bash_profile edits have not worked

When I enter

java -version

it returns

Unable to locate an executable at "/System/Library/Frameworks/JavaVM.framework//bin/java" (-1)

If I enter

which java

it returns

/usr/bin/java

I have looked online and found very similar problems but the general solution of editing the bash_profile and adding the code below does not work

export JAVA_HOME=/Library/Java/Home

Any help on how to solve this will be greatly appreciated.

Upvotes: 0

Views: 2705

Answers (1)

EJK
EJK

Reputation: 12527

The java in /usr/bin is just a symbolic link to /System/Library/Frameworks/JavaVM.framework//bin/java. This is standard on MacOS. It sounds like target of the symlink does not exist. You can fix this in one of two ways.

  1. Install a new version of Java. The installer should properly set the symlink.
  2. Manually set the symlink to a valid version of Java already installed in your system. If any exist, you will find them under /System/Library/Frameworks/JavaVM.framework/Versions.

To manually update the symlink, you will need admin privileges. Thus if the commands below do not work, try running them via sudo (i.e. put sudo in front of each command). Note the commands below assume you have java 1.6 installed. You will have to search your system to see exactly what versions are there an use the appropriate path the the java executable.

   cd /usr/bin
   rm java
   ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java

Upvotes: 2

Related Questions