使用 Eclipse 时,Ant 在哪里查找 Java Home?
我的 Ant 脚本无法编译代码。它说找不到“C:\Program Files\Java\jdk1.6.0_25”。这是正确的,它应该寻找“C:\ Program Files \ Java \ jdk1.6.0_24”
但是,我不知道它从哪里得到错误的引用。我的 Java_home 和所有 Eclipse 设置中似乎都有 24。它可以从哪里获得其他参考?我该如何修复它?
My Ant script won't compile code. It says it doesn't find a "C:\Program Files\Java\jdk1.6.0_25". Which is correct, it should be looking for "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. Where can it be getting this other reference from? How can I fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Eclipse 从
Project settings > 获取 Ant 的 JAVA_HOME Java 构建路径 >图书馆> JRE 系统库
不是来自 Windows %JAVA_HOME% 环境变量。通常它使用默认的 Eclipse JRE 设置,在您的情况下应为 C:\Program Files\Java\jdk1.6.0_24。
也许某些团队成员将项目设置更改为 C:\Program Files\Java\ jdk1.6.0_25 并提交了!?
因此您还必须检查项目设置,因为它们会覆盖常规 Eclipse 设置。
您是否已通过
Run As Ant Build...
和在 Eclipse 中以调试模式运行 antfile
主选项卡>参数> -调试>运行
以获取更多信息?您的脚本中是否涉及一些
fork=true
?还可以通过 :
将更多诊断输出放入您的 antfile 中,
以记录相关设置。
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.Normally it uses the default Eclipse JRE setting which should be C:\Program Files\Java\jdk1.6.0_24 in your case.
Maybe some team member altered the project setting to C:\Program Files\Java\jdk1.6.0_25 and made a commit !?
So you have to check the project settings also, because they overwrite the general Eclipse settings.
Did you already run your antfile in Eclipse with debugmode via
Run As Ant Build...
andMain Tab > Arguments > -debug > Run
to get more information ?Is there some
fork=true
involved in your script ?Also put some more diagnostic output in your antfile via :
to get the relevant settings logged.
您可以指定 ant 在 eclipse 中使用哪个 jre:preferences --> ant
you can specify which jre the ant uses in eclipse: preferences --> ant