在 Eclipse 中使用 Ant 时出现运行 javac.exe 编译器消息时出错 [英] Getting Error running javac.exe compiler message, while using Ant in Eclipse

查看:28
本文介绍了在 Eclipse 中使用 Ant 时出现运行 javac.exe 编译器消息时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 Eclipse 中运行 Ant 构建时,我收到以下错误消息并且 Ant 构建失败.

When I run my Ant build in Eclipse, I'm getting the following error message and the Ant build fails.

错误信息:运行 javac.exe 编译器时出错

Error Message: Error running javac.exe compiler

构建停止的行:

<javac destdir="${classes.home}" debug="on" fork="true" memoryinitialsize="512M" memorymaximumsize="1G">
        <classpath refid="classpath"/>
        <src path="${source.home}"/>
</javac>

有没有人遇到过类似的问题?或者有人知道这里出了什么问题吗?

Has anyone faced a similar problem before? or does anybody know what's wrong here?

系统信息:Eclipse Helio,JDK 1.5

System Information: Eclipse Helio, JDK 1.5

推荐答案

我遇到了同样的问题,问题是,在 Eclipse 中 java.home 指的是 JRE 而不是 JDK.我改变了它,构建成功.您可以执行以下操作将其更改为 JDK:

I had the same problem and the issue was, in eclipse java.home was referring to JRE instead of JDK. I changed it and the build was successful. You can do the following to change it to JDK:

Preferences > Java > Installed JRE's > Add... 对于'JRE Type'选择'Standard VM' > Next > Directory:选择你的JDK目录(而不是JRE)(在我的例子中:C:\Program Files\Java\jdk1.6.0_16 ),按确定.

Preferences > Java > Installed JRE's > Add... For 'JRE Type' select 'Standard VM' > Next > Directory: select your JDK directory (instead of JRE) (in my case: C:\Program Files\Java\jdk1.6.0_16 ), press OK.

现在,您返回到已安装的 JRE",请在此处也选择 JDK.

Now, you are back at 'Installed JRE's', select the JDK here also.

以下帖子有助于找到解决方案.JAVA_HOME指向错误的地方

The below post helped in finding the solution. JAVA_HOME points to the wrong place

这篇关于在 Eclipse 中使用 Ant 时出现运行 javac.exe 编译器消息时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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