简体   繁体   English

运行ant命令时发出

[英]Issue while running ant command

I installed ant in my system, when I run ant command, I get following error: 我在系统中安装了ant,当我运行ant命令时,出现以下错误:

Error: JAVA_HOME is not defined correctly. 错误:未正确定义JAVA_HOME。 We cannot execute /usr/lib/jvm/java-6-sun/bin/bin/java 我们无法执行/ usr / lib / jvm / java-6-sun / bin / bin / java

Please suggest what should I do? 请建议我该怎么办?

Set the environment variable JAVA_HOME to the installation directory of your JDK, which is: /usr/lib/jvm/java-6-sun 将环境变量JAVA_HOME为JDK的安装目录,该目录为: /usr/lib/jvm/java-6-sun

It looks like you have set it to /usr/lib/jvm/java-6-sun/bin (note the /bin at the end); 看起来您已经将其设置为/usr/lib/jvm/java-6-sun/bin (注意/bin在最后); the ant command appends another /bin so that you get .../bin/bin/java which is incorrect. ant命令会附加另一个/bin以便获得错误的.../bin/bin/java

In your Java installation directory, u can see a jre subdirectory that contains the bin directory that contains java and related executables. 在Java安装目录中,您可以看到jre子目录,该子目录包含bin目录,其中bin目录包含Java和相关的可执行文件。

So you should probably be setting JAVA_HOME to /usr/lib/jvm/jdk/jre rather than /usr/lib/jvm/jdk. 因此,您可能应该将JAVA_HOME设置为/ usr / lib / jvm / jdk / jre而不是/ usr / lib / jvm / jdk。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM