wood burning stoves*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
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: 1526
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: 5812
    
    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.


JBoss In Action
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
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: 5812
    
    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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant xml script & javac + JAVA_HOME classpath
 
Similar Threads
Compile and run a java program thru ant
Execute my java program with Ant
different size of jars created by ANT and batch command
B Eckel's build.xml and mine
Help: Modern compiler is not available.