views:

43

answers:

4

hello,

is it possible to specify which installation of java on the system should be used to run a java task? if yes, how?

in my case i want to specify if i want to run the 32bit or the 64bit version.

thanks!

+1  A: 

from http://www.jajakarta.org/ant/ant-1.6.1/docs/en/manual/CoreTasks/javac.html

fork Whether to execute javac using the JDK compiler externally; defaults to no

executable Complete path to the javac executable to use in case of fork="yes". Defaults to the compiler of the Java version that is currently running Ant. Ignored if fork="no". Since Ant 1.6 this attribute can also be used to specify the path to the executable when using jikes, jvc, gcj or sj.

Lyubomir Todorov
thanks, but i am not talking about compilation, but about execution. so the task is not javac but java.
clamp
A: 

Use the JAVACMD environment variable (see here)

king_nak
A: 

Since the <java> command doesn't let you specify the JVM, I'd suggest you use <exec> directly to execute the exact java binary and command line you want.

Sean Owen
+2  A: 

I believe this is what jvm attribute of the <java> Ant task is about.

jvm - the command used to invoke the Java Virtual Machine, default is 'java'. The command is resolved by java.lang.Runtime.exec(). Ignored if fork is disabled.

Grzegorz Oledzki