Search code examples
javaeclipseantjvm-arguments

passing Xmx argument to ant script from eclipse


Trying to pass a -Xms and -Xmx argument to Ant script that run through eclipse. But unable to pass through always getting :

Unknown argument: -J-Xms512m -J-Xmx1024m mytarget
Buildfile: C:\cehckout_trunk\myproject\ivy-build.xml
BUILD SUCCESSFUL
Total time: 31 milliseconds

Unknown argument: -Xms512m -Xmx1024m mytarget
Buildfile: C:\cehckout_trunk\myproject\ivy-build.xml
BUILD SUCCESSFUL
Total time: 31 milliseconds

Any quick pointer to eclipse runtime arguments for running ant script?


Solution

  • Looks like you are passing JVM arguments to Ant, not java. But the Ant executable doesn't accept JVM arguments. You should use the environment varible ANT_OPTS to specify the settings.

    Here is an example: http://wiki.apache.org/ant/TheElementsOfAntStyle

    Check the

    Use ANT_OPTS to control Ant's virtual machine settings

    part.