-2

I have Mac OS 10.8.4 when I type in terminal >java i got an error

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

Have no idea where and when its missed...Few days ago everything was fine. How to fix that ? Is that because I installed java 1.7 ?

Jim
  • 8,874
  • 16
  • 68
  • 125
  • who did down-vote and for what ? – Jim Jul 29 '13 at 20:30
  • 1
    I downvoted, because the question basically boils down to "I broke my computer, what should I do?". There's not enough details to tell you what exactly is wrong, except for the fact that your java executable isn't where the system expects it. You also didn't share any effort on your part trying to debug or fix it... I guess a reinstallation and checking your path and JAVA_HOME should solve the problem in most cases. Also, it's off-topic for SO and more suited for SuperUser in my opinion, because the only thing it has to do with programming is that the program that broke is java. – l4mpi Jul 29 '13 at 20:41

3 Answers3

3

Check first: whereis java, usually it is /usr/bin/java

Probably symbolic link for java in /usr/bin is not pointing to the right location. You can set this link manually to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java Also check other processes: javac, javadoc, javap, javaws and javah.

Additionally you can define JAVA_HOME in your .bash_profile.

  1. cd /usr/bin
  2. ls -l | grep java - check if it is indeed pointing to that wrong location
  3. rm java - delete symbolic link
  4. ln -s /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java java
  5. try java -version
Alex P
  • 1,721
  • 1
  • 17
  • 18
0

Did Mac OS block it again? Do you need to update to the latest version from java.com?

Sarel Botha
  • 12,419
  • 7
  • 54
  • 59
0

Download the Oracle Java SE JDK.