Java – Specifying jvm arguments in ant tasks

antjavajvm-arguments

I am specifying jvm arguments since i was getting out of heap space exception so just to avoid that i was specifying the below parameters in my ant target that is as shown below..

  <junit
   printsummary="true"
   fork="yes"
   haltonfailure="false"
   failureproperty="junitsFailed"
   errorProperty="junitsFailed"
  >
   <jvmarg value=" -Xmx1024m -Duser.timezone=GMT0"/>
  </junit>

but below i am getting the below exception ..

that is the invalid parameters are specified

Best Solution

Use multiple <jvmarg> elements:

<junit printsummary="true" fork="yes" haltonfailure="false" failureproperty="junitsFailed" errorProperty="junitsFailed">
    <jvmarg value="-Xmx1024m"/>
    <jvmarg value="-Duser.timezone=GMT0"/>
</junit>