蚂蚁公然无视JAVA_HOME环境变量 [英] Ant flagrantly ignoring JAVA_HOME environment variable

查看:194
本文介绍了蚂蚁公然无视JAVA_HOME环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚拿起最新版Android SDK的,开始尝试使用它。与几乎所有的人想出这个问题,我运行Linux,也就是Linux Mint的13。目前,我正在试图编译使用蚂蚁一个Hello World程序,通过

I just picked up the latest version of the Android SDK and started trying to use it. Unlike almost everyone else coming up with this problem, I'm running Linux, namely Linux Mint 13. I'm currently trying to compile a Hello World program using ant, installed via

sudo apt-get install ant

和项目文件夹运行:

ant debug

然而,它不能完全编译,最后吐出一个错误做设定 JAVA_HOME 。我相应的修改我的〜/ .bashrc中文件并重新启动,但我仍然得到错误:

However, it fails utterly to compile, eventually spitting out an error to do with setting JAVA_HOME. I amended my ~/.bashrc file accordingly and restarted, but I still get the error:

Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"

Total time: 1 second
jamie@jamie-ThinkPad-E525 ~/Downloads/adt-bundle-linux/sdk/tools/projects/new $ echo $JAVA_HOME
/usr/java/jdk1.7.0_05/

正如你可以看到,它在说谎通过它的牙齿。

As you can see, it's lying through its teeth.

我发现很多对这一问题的参考,但大多数人要么设置其JAVA_HOME不正确,或者将其设置为JRE。很显然,我已经做了没有。

I've found lots of references to this problem, but most people have either set their JAVA_HOME incorrectly, or set it to the JRE. Clearly, I have done neither.

我也修改了我的项目文件夹的 ant.properties 文件,添加行

I also amended my project folder's ant.properties file, adding the line

java.home =的/ usr / JAVA / jdk1.7.0_05 /

无济于事。

任何人都经历/解决了这个问题,或者有什么想法?谢谢你。

Has anyone else experienced/solved this problem, or got any ideas? Thanks.

推荐答案

有机会,蚂蚁说的是实话,而且环境变量未设置。机会是:

The chances are that ant is telling the truth and that the environment variable is not set. The chances are that:


  • 您把错误的语句转换成的.bashrc文件,或

  • 您没有重新启动的正常

  • you put the wrong statement into the ".bashrc" file, or
  • you didn't restart properly.

无论如何,你可以通过在shell中运行导出验证这一点之前运行蚂蚁命令并期待,看看是否 JAVA_HOME 变量是上市。

Anyway, you can verify this by running export in the shell before to run the ant command ... and looking to see if the JAVA_HOME variable is listed.

提示:

1),这是错误的:

JAVA_HOME=/usr/java/jdk1.7.0_05/

这只是创建一个本地shell变量和本地shell变量不传递给子进程(如蚂蚁命令)。它应该是:

That only creates a local shell variable, and local shell variables are NOT passed to child process (like the ant command). It should be:

export JAVA_HOME=/usr/java/jdk1.7.0_05/

2)尝试运行这样的:

2) Try running this:

export JAVA_HOME=/usr/java/jdk1.7.0_05/
ant

3)添加 java.home =的/ usr / JAVA / jdk1.7.0_05 / 来ant.properties也无济于事。蚂蚁预计在环境变量的设置。

3) Adding java.home=/usr/java/jdk1.7.0_05/ to ant.properties won't help. Ant expects the setting in an environment variable.

4)计算机程序不撒谎。他们说实话,因为他们看到它。或者更准确,说谎和说真话的整个概念是没有意义的,除非代理能够意向。但问题是,如果你开始怀疑试图欺骗你的电脑程序,你将有一个很难调试的事情。

4) Computer programs don't lie. They tell the truth as they see it. Or to be more accurate, the whole notion of lying and telling the truth is meaningless unless the agent is capable of intention. But the point is that if you start to suspect computer programs of trying to deceive you, you are going to have a hard time debugging things.

(OK,你在开玩笑,但许多人面对故障排除问题采取了类似的非生产性方式;如假设每一个棘手的Java问题证据表明,编译器/语言/运行时IMO破 - 这是值得提醒人们,这种想法是非常无益的....)

这篇关于蚂蚁公然无视JAVA_HOME环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆