File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes jvm version used by ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "jvm version used by ant" Watch "jvm version used by ant" New topic
Author

jvm version used by ant

Stephen Bloch
Ranch Hand

Joined: Aug 19, 2003
Posts: 48
I'm running Ant from Eclipse, and the two seem to disagree on what version of Java (both compiler and jvm) to use: Eclipse uses 1.4, and Ant insists on 1.3. The exact same source file compiles directly from Eclipse, but not from an ant task invoked from Eclipse. How do I tell Ant what version of Java to use?

(Java 1.5 is not available yet for the Mac, as I understand it... and if it were, it wouldn't run on MacOS 10.2.8, which I haven't upgraded to 10.3 yet because 10.4 is coming Any Month Now. When that happens, I'll be upgrading OS, Java, Eclipse, and Ant all at once....)


Addendum: I've tried setting "build.compiler" earlier in the ant buildfile; no dice. I tried "ant.build.compiler"; ditto. I tried putting 'compiler="javac1.4"' in each individual <javac> task; no dice. However, I seem to have managed it by putting 'executable="/usr/bin/javac"' in each individual <javac> task. There must be a better way, but at least I've got a workaround for the moment....
[ December 01, 2004: Message edited by: Stephen Bloch ]

SCJP 1.4
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
What does your "JAVA_HOME" environment variable look like?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Stephen Bloch
Ranch Hand

Joined: Aug 19, 2003
Posts: 48
JAVA_HOME is set (on my Mac) to /Library/Java/Home, which contains three directories: bin, include, and lib. The bin directory contains symlinks to java, javac, javadoc, jdb, jar, etc. in /System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/bin. The command

${JAVA_HOME}/bin/java -version

reports 1.4.1_01.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
What does it report when you just type

java -version

?
Stephen Bloch
Ranch Hand

Joined: Aug 19, 2003
Posts: 48
Same: 1.4.1_01 .
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Try the -debug option for Ant, perhaps it's giving you some hints on what's going on...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jvm version used by ant