Getting Error running javac.exe compiler message,

2019-02-01 06:32发布

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

Error Message: Error running javac.exe compiler

Line where the build stops:

<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?

System Information: Eclipse Helio, JDK 1.5

16条回答
你好瞎i
2楼-- · 2019-02-01 06:46

If you are running ant in eclipse click run as --> Ant second option and choose JDK path and run the build again.

查看更多
祖国的老花朵
3楼-- · 2019-02-01 06:46

I've tried everything but nothing worked for me till I've set (fork='no' or fork='false' in your case) and worked for me perfectly

查看更多
乱世女痞
4楼-- · 2019-02-01 06:46

I fixed the problem like this:

My Java home folder had the wrong path. It should have been C:\Program Files (x86)\Java\jdk1.5.0_15 but instead it was C:\Program Files (x86)\Java\jdk1.5.0_15\bin.

查看更多
贪生不怕死
5楼-- · 2019-02-01 06:46

The accepted answer didn't work for me. But right-clicking in Ant and setting the Java Runtime Environment (JRE) to the Jave Development Kit (JDK) worked for me.

Abhi Rampal's answer is the step by step the same way I solved the problem on my eclipse.

Go to Run -> External Tools -> External Tools Configuration -> select your build.xml on the left menu -> select JRE tab -> select the JDK(from the dropdown) for Separate JRE radio button option -> Click Run.

查看更多
狗以群分
6楼-- · 2019-02-01 06:47

Configuring eclipse to point to JDK instead of JRE did not work for me. With further investigation, I solved this problem by stopping the build process from forking. In your build.xml, remove the attribute fork from <javac> tag.

查看更多
小情绪 Triste *
7楼-- · 2019-02-01 06:48

Try changing memorymaximumsize="1G" to memorymaximumsize="512M".

查看更多
登录 后发表回答