简体   繁体   English

使用Eclipse时,Ant会在哪里找到您的Java Home?

[英]Where does Ant look to find your Java Home when using Eclipse?

My Ant script won't compile code. 我的Ant脚本无法编译代码。 It says it doesn't find a "C:\\Program Files\\Java\\jdk1.6.0_25". 它说找不到“ C:\\ Program Files \\ Java \\ jdk1.6.0_25”。 Which is correct, it should be looking for "C:\\Program Files\\Java\\jdk1.6.0_24" 正确的是,它应该寻找“ C:\\ Program Files \\ Java \\ jdk1.6.0_24”

However, I don't know where it is getting the bad reference from. 但是,我不知道它从哪里得到了不好的参考。 I seem to have 24 on Java_home and in all my Eclipse settings. 我的Java_home和所有Eclipse设置中似乎都有24个。 Where can it be getting this other reference from? 从哪里可以得到其他参考? How can I fix it? 我该如何解决?

Eclipse gets his JAVA_HOME for Ant from the Project settings > Java Build Path > Libraries > JRE System Library not from Windows %JAVA_HOME% environment variable. Eclipse并非从Windows%JAVA_HOME%环境变量中,而是从Project settings > Java Build Path > Libraries > JRE System Library获取Ant的JAVA_HOME。
Normally it uses the default Eclipse JRE setting which should be C:\\Program Files\\Java\\jdk1.6.0_24 in your case. 通常,它使用默认的Eclipse JRE设置,在您的情况下应为C:\\ Program Files \\ Java \\ jdk1.6.0_24。

Maybe some team member altered the project setting to C:\\Program Files\\Java\\jdk1.6.0_25 and made a commit !? 也许某些团队成员将项目设置更改为C:\\ Program Files \\ Java \\ jdk1.6.0_25并提交了!
So you have to check the project settings also, because they overwrite the general Eclipse settings. 因此,您还必须检查项目设置,因为它们会覆盖常规的Eclipse设置。

Did you already run your antfile in Eclipse with debugmode via Run As Ant Build... and 您是否已经通过Run As Ant Build...在Debug模式下在Eclipse中运行antfile和
Main Tab > Arguments > -debug > Run to get more information ? Main Tab > Arguments > -debug > Run以获取更多信息?
Is there some fork=true involved in your script ? 您的脚本中是否包含一些fork=true
Also put some more diagnostic output in your antfile via : 还可以通过以下方式在您的antfile中添加更多诊断输出:

<echoproperties prefix="java"/>
<echoproperties prefix="ant"/>

to get the relevant settings logged. 记录相关设置。

you can specify which jre the ant uses in eclipse: preferences --> ant 您可以指定蚂蚁在日食中使用哪个jre:首选项-> ant

在此处输入图片说明

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

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