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

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

问题描述

我无法运行我的Ant build.xml,因为我更新到java 1.7.0_52(或那里)。我已经在我的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(从错误消息中也可以看出)。我一直在路径中使用带有bin文件夹的JAVA_HOME。我已经配置了Eclipse - 外部工具配置 - JRE指向相同的D:\ Morten \ Java \ _ddk1.7.0_52(通过Separate 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天全站免登陆