简体   繁体   English

错误 - / bin / sh:找不到java:命令

[英]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.

相关问题 Java中的sshpass给出错误:/ bin / sh:sshpass:找不到命令 - sshpass in Java gives error: /bin/sh: sshpass: command not found 使用 cron 运行 jar 会引发错误:&#39;/bin/sh: 1: java: not found&#39; - Running jar with cron throws error: '/bin/sh: 1: java: not found' 如何解决/bin/sh: protoc: command not found? - how to solve /bin/sh: protoc: command not found? docker centos:6.6镜像“ / bin / sh:java:找不到命令”,安装了java - docker centos:6.6 image “/bin/sh: java: command not found” java is installed Dockerfile: /bin/sh: 1: ./mvnw: 找不到错误 - Dockerfile : /bin/sh: 1: ./mvnw: not found error / bin / sh:1:未找到触摸 - /bin/sh: 1: touch not found 找不到 Synology Scheduler .sh java 命令 - Synology Scheduler .sh java command not found PIVOTAL GPDB- 外部表 gphdfs 协议命令以错误结束。 sh:java:找不到命令 - PIVOTAL GPDB- External table gphdfs protocol command ended with error. sh: java: command not found 当我尝试运行 docker 它说 /bin/sh: [java,-jar,/bin/sh/hellotm-0.0.1-snapshort.jar]: not found - When i try to run docker it says /bin/sh: [java,-jar,/bin/sh/hellotm-0.0.1-snapshort.jar]: not found Jmeter&gt;&gt;&gt;每次执行./jmeter命令时都发现错误(./jmeter:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java:未找到) - Jmeter>>> i found a error every time when i execute ./jmeter command(./jmeter: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java: not found)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM