Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jvm version used by ant

 
Stephen Bloch
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your "JAVA_HOME" environment variable look like?
 
Stephen Bloch
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does it report when you just type

java -version

?
 
Stephen Bloch
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same: 1.4.1_01 .
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the -debug option for Ant, perhaps it's giving you some hints on what's going on...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic