Increase memory of Eclipse Ant Runner


I am running the Eclipse ant runner from command line in the following way:

set LAUNCHER=xx\xx\org.eclipse.equinox.launcher_1.1.3.0.jar
xx\xx\java.exe -jar %LAUNCHER% -application org.eclipse.ant.core.antRunner -buildfile build.xml

I am facing OutOfMemory errors in the heap space. Adding -vmargs -Xmx512m to the command line or and changing the properties of my eclipse installation eclipse.ini file didn’t fixed the issue.

In order to be sure that the vmargs are taken into account I simply wrote the folowing task:

public class DisplayTask extends Task {
@Override
public void execute() throws BuildException {
System.out.println(Runtime.getRuntime().maxMemory() / 1000000);
}
}

and just launch it in my build.xml (using taskedf to define the task). The output is always 66 whatever I put in -vmargs -Xmx ….
After several tests I got the solution by adding -Xmx512m  only (without -vmargs) option just after the java.exe as folowing:

xx\xx\java.exe -Xmx512m -jar %LAUNCHER% -application org.eclipse.ant.core.antRunner -buildfile build.xml

Conclusion: the ant runner application doesn’t read neither the -vmargs command line options nor the eclipse.ini file options. Thus the only solution to increase memory for it is to directly pass the option to the Java virtual machine.

Advertisements

5 thoughts on “Increase memory of Eclipse Ant Runner

  1. You shouldn’t have the -Xmx after the -jar, it should be before it. In any case, it’s only the eclipse.exe executable that understands the -vmargs flag; when you run java -jar LAUNCHER then you are creating the VM and must thus specify the arguments yourself. Note that the -vmargs would have worked if you’d done eclipse -vmargs -Xmx512m -application org.eclipse.ant.core.antRunner -buildfile build.xml

    • You are right, I did a mistake in the post command line (but not in the text saying to add the option just after java.exe): I just edited my post to fix that. Thanks. I tired the solution using eclipse.exe -application as you said but instead of launching the ant runner it opened a workbench ?!#? May be I did a mistake somewhere …

  2. Pingback: Increase memory of Eclipse Ant Runner | Eclipse | Syngu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s