[英]Error - /bin/sh: java: command not found
I get the following error when I try to run JSLint from SublimeText 2 on my Mac: 当我尝试从Mac上的SublimeText 2运行JSLint时出现以下错误:
/bin/sh: java: command not found
I think it is to do with Java not being in the PATH
on Mac, can anyone help with this please? 我认为这与Java不在Mac上的
PATH
有关,有人可以帮忙吗?
Open up terminal and start editing .bash_profile 打开终端并开始编辑.bash_profile
vi ~/.bash_profile
then add the following 然后添加以下内容
export JAVA_HOME=/usr/java/jdk<your JDK folder>
export PATH=$PATH:/usr/java/jdk<your JDK folder>/bin
Save and close. 保存并关闭。
From this article and a couple of others, it looks like you edit your ~/.profile
file (the .profile
in your home directory), find the line that starts with export PATH=...
, and add the Java bin
directory at the beginning or end, separating it from the previous/next element with a colon ( :
). 在本文和其他
~/.profile
文章中,看起来您编辑~/.profile
文件(主目录中的.profile
),找到以export PATH=...
开头的行,并添加Java bin
目录的开始或结束,从与结肠上一个/下一个元素将其分离( :
)。
Eg, if it looks like this: 例如,如果它看起来像这样:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
change it to 改为
export PATH=/opt/local/bin:/opt/local/sbin:$PATH:/path/to/java/bin
or 要么
export PATH=/opt/local/bin:/opt/local/sbin:/path/to/java/bin:$PATH
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.