使用ANT_OPTS影响目标java应用程序

时间:2021-01-29 00:23:31

I have a 2gig linux 64bit OS. I am using ant 1.7.1 and jdk 1.6_31. I have a simple app that prints that asks for the size of the Maximum java heap and prints it. I am using export ANT_OPTS="-Xmx64M" but when I run my little application with ant target in build.xml, it reports 446Meg.

我有一个2gig的linux 64位操作系统。我使用的是ant 1.7.1和jdk 1.6_31。我有一个简单的应用程序,它打印请求最大java堆的大小并打印它。我正在使用export ANT_OPTS=“-Xmx64M”,但是当我在构建中使用ant target运行我的小应用程序时。xml,它报告446梅格。

<target name="askmem">
    <java
        fork="true"
        classname="com.stagirite.test.AskMemory"
        classpathref="project.classpath">

        <classpath path="${build.dir}"/>
    </java>
</target>

I must be doing something wrong? (I discovered from * that with this JVM, the default heap is 1/4 total memory, which is what is happening, rather than the value I specified in ANT_OPTS.

我一定是做错了什么?(我从*上发现,对于这个JVM,默认堆是1/4的总内存,而不是ANT_OPTS中指定的值。

Andy

安迪

1 个解决方案

#1


2  

You're forking the Java anyway, so even if ANT_OPTS did affect the java task, I don't think they'd transfer to it. ANT_OPTS is for ant itself.

无论如何,您是在为Java分叉,所以即使ANT_OPTS确实影响了Java任务,我认为它们也不会转移到它。ANT_OPTS是ant本身。

If you want to control the JVM used by the forked java task, use nested <jvmargs> elements.

如果您想要控制fork java任务使用的JVM,请使用嵌套的 元素。

#1


2  

You're forking the Java anyway, so even if ANT_OPTS did affect the java task, I don't think they'd transfer to it. ANT_OPTS is for ant itself.

无论如何,您是在为Java分叉,所以即使ANT_OPTS确实影响了Java任务,我认为它们也不会转移到它。ANT_OPTS是ant本身。

If you want to control the JVM used by the forked java task, use nested <jvmargs> elements.

如果您想要控制fork java任务使用的JVM,请使用嵌套的 元素。