问题描述
我在 mac osx 10.7.3 中遇到了 Java 的可悲问题.以前我安装了它,它运行良好.随着时间的推移,在 .bash_profile 和 .profile 文件中进行了一些更改后,我遇到了像
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"
每当我尝试在终端中运行javac"或java"时.
whenever I try to run "javac" or "java" in my terminal .
echo $PATH
给出如下输出:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/sabya/Documents/Play_Framework/play-2.0:/usr/X11/bin:/usr/local/git/bin:/usr/local/mysql/bin
我的 .bash_profile 看起来像:
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
which java
/usr/bin/java
它困扰了我很长时间,卸载和安装 Java 对我的运气没有帮助.
Its bugging me for long days and uninstalling and installing java did not help my luck .
我是 Mac 新手,需要帮助来解决这个问题.
I am a newbie in Mac and need help to sort out this issue .
在发布这个问题之前,谷歌搜索并看到了 SOF,但没有找到任何针对我的问题的内容.
Googled and saw SOF before posting this question but did not find anything specific to my problem .
谢谢
萨比亚
推荐答案
毫无疑问,export JAVA_HOME=/usr/bin/java
是罪魁祸首.此 env var 应指向 JDK 或 JRE 安装目录.谷歌搜索显示 MacOS X 的最佳选择似乎是 export JAVA_HOME=/Library/Java/Home
.
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
.
这篇关于无法在“/usr/bin/java/bin/java"中找到可执行文件;(-1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!