jQuery in Action, 2nd edition
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant xml script & javac + JAVA_HOME classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "Ant xml script & javac + JAVA_HOME classpath" Watch "Ant xml script & javac + JAVA_HOME classpath" New topic
Author

Ant xml script & javac + JAVA_HOME classpath

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1351
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?


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 4875

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.


JBoss In Action
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1351
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

Joined: May 14, 2008
Posts: 4875

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?
 
 
subject: Ant xml script & javac + JAVA_HOME classpath
 
Threads others viewed
Execute my java program with Ant
Help: Modern compiler is not available.
Compile and run a java program thru ant
different size of jars created by ANT and batch command
B Eckel's build.xml and mine
MyEclipse, The Clear Choice