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.
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 …
[...] -buildfile build.xml I am facing OutOfMemory errors in the heap space. Adding -vmargs… Read more… Categories: Eclipse Share | Related [...]
Hi, but you only have to edit your configuration file and set Xms and Xmx higher, isn’t it ? Why not ?
Which configuration file are you speaking about ?