Ant“JAVA_HOME不指向JDK"- 但确实如此 [英] Ant "JAVA_HOME does not point to the JDK" - but it does

查看:37
本文介绍了Ant“JAVA_HOME不指向JDK"- 但确实如此的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我更新到 java 1.7.0_52(或大约)以来,我无法运行我的 Ant build.xml.我已经在我的 Windows 7 笔记本电脑上通过 Eclipse 本地运行它多年了 - 但是这个最新的 jave jdk 更新有些不同(?).

I cannot run my Ant build.xml since I updated to java 1.7.0_52 (or there about). I have been running it for years through Eclipse locally on my Windows 7 laptop - but with this latest jave jdk update somethings different (?).

BUILD FAILED
C:\workspace\WaterAspectsModel3\build.xml:329: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "D:\Morten\Java\jdk1.7.0_52"

这是我的jdk!所以 JAVA_HOME 指向一个 jdk(从错误消息中也很清楚).我的 JAVA_HOME 和 bin 文件夹一如既往地在我的路径中.我已经配置了 Eclipse - 外部工具配置 - 一个 JRE 指向相同的 D:\Morten\Java\jdk1.7.0_52 (通过单独的 JRE"设置).而且我尝试了许多其他配置 - 都没有运气.

This is my jdk! So JAVA_HOME is pointing to a jdk (as is also clear from the error message). I have my JAVA_HOME with bin folder in my path as always. I've configured Eclipse - external tools configuration - with a JRE pointing to the same D:\Morten\Java\jdk1.7.0_52 (through "Separate JRE" setting). And I've tried a number of other configurations - all without luck.

我一直在阅读此处和其他地方列表中的大量答案,并认为我已经尝试了所有建议.大多数情况似乎是 JAVA_HOME 实际上指向 jre 并且只需要更正为 jdk 或者有一个;"在路径或类似的东西.这些似乎都不适用于我的情况.

I've been reading the tonnes of answers on lists here and other places and think I've tried all suggestions. Most seem to be cases where JAVA_HOME actually points to a jre and just needs to be corrected to jdk or there's a ";" in the path or something like that. None of these seem to apply in my case.

有什么建议吗?

推荐答案

真正的消息是 Ant 找不到 com.sun.tools.javac.Main.

The real message is that Ant can't find com.sun.tools.javac.Main.

加上最新的Sun"(Oracle) JDK 是 1.7.0_13(或者可能是 _14,但绝对不是您的安装目录指示的_52")这一事实,让我认为您不是使用 Ant 识别的发行版.您可以通过运行 jar tvf $JAVA_HOME/lib/tools.jar 并查找该类来验证这一点.

Which, together with the fact that the latest "Sun" (Oracle) JDK is 1.7.0_13 (or maybe _14, but definitely not the "_52" that your install dir indicates), makes me think that you're not using a distribution that Ant recognizes. You can verify this by running jar tvf $JAVA_HOME/lib/tools.jar, and looking for that class.

Ant 手册 讨论了使用不同编译器的方法.由于我只用过Sun"编译器,恐怕不能给你任何指点.

The Ant Manual talks about ways to work with different compilers. Since I've only used "Sun" compilers, I'm afraid that I can't give you any pointers.

您也可以尝试在构建文件中设置 fork="yes".这应该运行编译器可执行文件,而不是尝试调用编译器类.

you could also try setting fork="yes" in your build file. This should run the compiler executable rather than trying to invoke the compiler class.

这篇关于Ant“JAVA_HOME不指向JDK"- 但确实如此的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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