# Ant xml script & javac + JAVA_HOME classpath

Akhilesh Trivedi
Ranch Hand
Posts: 1608
I am using Eclipse and a build.xml to build an EJB jar.

In my build.xml I have

On running the xml script. I get following error.

In my Environment Variables i do have the entry for JAVA_HOME and it is for JDK only and not JRE. Where is the problem?

Peter Johnson
author
Bartender
Posts: 5856
7
The problem is that Eclipse is running with a JRE and that is what is being use to run Ant. To fix this, do one of the following:

a) Change the eclipse.ini file to use a JDK. See http://www.coderanch.com/t/488574/vc/Eclipse-running-JRE-but-JDK#2529046

b) Add the JDK to Eclipse preferences under Installed JREs. Then either make that JDK the default, or change the project to use that JDK.

P.S. Eclipse ignores JAVA_HOME.

Akhilesh Trivedi
Ranch Hand
Posts: 1608
Thanks Peter. I had close and re-open Eclipse and found the Environment Varaible JAVA_HOME came into effect.

By the way where can we change the same in eclipse. ini

here?

Peter Johnson
author
Bartender
Posts: 5856
7
Akhilesh Trivedi wrote:By the way where can we change the same in eclipse. ini

Did you look at the link I provided? At the whole discussion?