设置java home [英] Setting java home
问题描述
我正在尝试使用命令ant build。消息说 java home未正确定义我们无法执行/ usr / bin / java // bin / java<注意2斜杠>
I'm trying to use the command "ant build".The message says java home is not defined correctly we cannot execute /usr/bin/java//bin/java <notice the 2 slashes>
如果我使用命令 echo $ JAVA_HOME
,则返回 usr / bin / java
。需要更改的内容是什么?
If i use the command echo $JAVA_HOME
it returns usr/bin/java
. What needs changing here?
推荐答案
$ JAVA_HOME
变量未引用到java可执行文件,但是到 bin / java
可执行文件本身的父目录。这就是Ant抱怨无法执行一些神秘的 / usr / bin / java // bin / java
的原因。
The $JAVA_HOME
variable does not refer to the java executable, but to the parent directory of the bin/java
executable itself. This is the reason Ant complains of not being able to execute some cryptic /usr/bin/java//bin/java
.
例如,在我的情况下(Ubuntu 12.04,OpenJDK),java home设置为
For example, in my case (Ubuntu 12.04, OpenJDK) the java home is set to
/usr/lib/jvm/java-6-openjdk-amd64/jre
显然存在 / usr / lib / jvm / java-6-openjdk-amd64 / jre / bin / java
,其中 / usr / bin / java
最终代表一个符号链接。
where obviously there exists a /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
, of which /usr/bin/java
ultimately represents a symbolic link.
这篇关于设置java home的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!