For compilation of my Java code, I would like to know if its possible to use one version of the JRE(rt.jar) and use javac belonging to another version of JDK. If yes, how do we include it in the build.xml in Ant? Thanks in advance!
Asked
Active
Viewed 976 times
-1
-
1Possible duplicate of [How to change Ant compiler to JDK 1.6](http://stackoverflow.com/questions/11551678/how-to-change-ant-compiler-to-jdk-1-6) – Chad Nouis May 10 '16 at 14:18
-
I know how to change the Ant compiler to a different version. My question is whether it is possible for ant to pick up different JRE and JDK when doing the build. Essentially, if it is possible to have some parameters passing different JRE/JDK values to the build. – Müller May 11 '16 at 05:26
1 Answers
0
Yes, you can. You use the executable
attribute to specify the exact location of javac you want to use, so you can point to another JDK. And you need to set the fork
attribute to yes
.
<javac fork="yes" executable="...path.../jdk/bin/javac">

Roberg
- 1,083
- 1
- 12
- 11
-
Which JRE is used in the above case? the one present in `...path.../jdk/` ? If yes, then this is not what i want – Müller May 11 '16 at 05:25
-