简体   繁体   English

如何增加org.eclipse.ant.core.antRunner的内存

[英]How increase memory of org.eclipse.ant.core.antRunner

I am running the Eclipse ant runner from command line in the following way: 我以以下方式从命令行运行Eclipse ant运行程序:

set LAUNCHER=%ECLIPSE_SDK%\eclipse\plugins\org.eclipse.equinox.launcher_1.1.3.0.jar

%JAVA_HOME%\bin\java.exe -jar %LAUNCHER% -application org.eclipse.ant.core.antRunner -propertyfile %PROPERTIES% -buildfile build.xml

How do I increase the memory provided to this jvm instance ? 如何增加提供给该jvm实例的内存? I am asking this because I am facing OutOfMemory errors in the heap space and adding -vmargs -Xmx512m to the command line didn't fixed the issue 我问这个问题是因为我在堆空间中遇到OutOfMemory错误,并且在命令行中添加了-vmargs -Xmx512m并没有解决问题

In order to see if -vmargs are taken into account I simply wrote the folowing task: 为了查看是否考虑了-vmargs,我简单地编写了以下任务:

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). 然后在我的build.xml中启动它(使用taskedf定义任务)。 The output is always 66 whatever I put in -vmargs -Xmx .... 无论我在-vmargs -Xmx ...中输入什么,输出始终为66。

I got it, the solution is to add -Xmx512m option just after the java.exe as folowing: 我知道了,解决方案是在java.exe 之后添加-Xmx512m选项,如下所示:

%JAVA_HOME%\bin\java.exe **-Xmx512m** -jar %LAUNCHER% -application org.eclipse.ant.core.antRunner -propertyfile %PROPERTIES% -buildfile build.xml

This is finally NORMAL. 这终于是正常的。 Only the eclipse.exe executable understands the -vmargs flag; 只有eclipse.exe可执行文件可以理解-vmargs标志; when I run java -jar LAUNCHER then I am creating the VM and must thus specify the arguments myself. 当我运行java -jar LAUNCHER时,我正在创建VM,因此必须自己指定参数。

如果使用的是本地Equinox Launcher(不是,但可能应该--launcher.appendVmargs附带精心制作的VM参数),您应该了解--launcher.appendVmargs参数(请参阅Eclipse运行时选项Eclipse / 149994eclipse.ini)详情

 # eclipse --launcher.appendVmargs -vmargs  -Xmx512m -application org.eclipse.ant.core.antRunner -propertyfile %PROPERTIES% -buildfile build.xml

您可以尝试设置ANT_OPTS系统变量: http : //www.liferay.com/community/wiki/-/wiki/Main/Ant+opts

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM