How to install java_home in ant build xml

I need to run a project on java 1.4 and pmd and findbugs on java 1.5
So, I need to install java_home in my XML build file.

Thanks in advance,
-Stravan

+4
source share
2 answers

There is a jvm attribute for the java task:

<java jvm="PATH_TO_YOUR_VM" fork="true"...> ... </java> 
+4
source

Alternatively, if you are on Windows, you can create 2 batch files: one that sets JAVA_HOME to 1.3, and then your ant call, the second that sets JAVA_HOME to 1.4, and then your ant call. eg:

startAnt1.3.bat:

 SET JAVA_HOME=C:\Java1.3\etc. ant myTarget 

startAnd1.4.bat:

 SET JAVA_HOME=C:\Java1.4\etc. ant myTarget 
0
source

Source: https://habr.com/ru/post/1336838/


All Articles