JAVA_HOME 环境变量用于指定 Java 的安装路径,在使用 ant 运行命令时会用到。

huangapple go评论56阅读模式
英文:

JAVA_HOME path for ant run command

问题

我正在尝试在我的系统上安装contiki-ng,一切都进行得很顺利,直到我尝试在contiki-ng/tools/cooja目录中运行ant run命令,然后我得到了以下响应:

> 我们无法运行Java,请确保您已安装Java。
> 我们尝试执行/usr/lib/jvm/java-11-openjdk-amd64/bin/java/bin/java,但是失败了。
> 如果您在不寻常的位置安装了Java,您可以设置JAVA_HOME
为包含Java安装的目录。

我意识到我需要将.bashrc文件中的/usr/lib/jvm/java-11-openjdk-amd64/bin/java/bin/java更改为/usr/lib/jvm/java-11-openjdk-amd64/bin/java(移除路径末尾的/bin/java;我复制路径时弄错了)。

即使在那样做之后,我仍然收到相同的错误。有人可以帮忙吗?

英文:

I am trying to install contiki-ng in my system and everything has proceeded well, until I try to run the ant run command in contiki-ng/tools/cooja directory, upon which I get the following response:

> We cannot run Java, please ensure you have Java installed.
> We have tried to execute /usr/lib/jvm/java-11-openjdk-amd64/bin/java/bin/java but failed.
> If you have installed Java in a unusual place you can set JAVA_HOME
to the directory containing the Java installation.

I realized that I had to change /usr/lib/jvm/java-11-openjdk-amd64/bin/java/bin/java to /usr/lib/jvm/java-11-openjdk-amd64/bin/java (remove /bin/java from the end; I had copied the path wrong) in the .bashrc file.

Even after doing that, I am still getting the same error. Can someone help?

答案1

得分: 3

你应该将JAVA_HOME设置为/usr/lib/jvm/java-11-openjdk-amd64,因为它应该指向Java主目录,而不是bin目录。

英文:

you should have JAVA_HOME set to /usr/lib/jvm/java-11-openjdk-amd64 because it should point to java home directory, not bin directory

huangapple
  • 本文由 发表于 2020年9月30日 22:43:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/64140039.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定