退出OutOfMemoryError:Java中的Java堆空间

时间:2018-06-27 16:10:40

标签: java

尽管通过传递附加的vm参数-Xms512m -Xmx1524m,但通过Eclipse通过ANT运行build.xml文件时,却出现以下错误消息,但仍然出现堆空间错误。请提出解决方法。

compileEJBSource:
     [echo] compileEJBSource ...
    [javac] Compiling 4 source files to C:\AVN\FT\CoreERT\Product\classes
    [javac] The system is out of resources.
    [javac] Consult the following stack trace for details.
    [javac] java.lang.OutOfMemoryError: Java heap space
    [javac]     at com.sun.tools.javac.parser.Scanner.getRawCharacters(Scanner.java:1075)
    [javac]     at com.sun.tools.javac.parser.DocCommentScanner.getLineMap(DocCommentScanner.java:417)
    [javac]     at com.sun.tools.javac.parser.JavacParser.parseCompilationUnit(JavacParser.java:2310)
    [javac]     at com.sun.tools.javac.parser.EndPosParser.parseCompilationUnit(EndPosParser.java:83)
    [javac]     at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:595)
    [javac]     at com.sun.tools.javac.main.JavaCompiler.complete(JavaCompiler.java:741)

1 个答案:

答案 0 :(得分:0)

您可以将其设置为ANT的选项。使用“ ANT_OPTS”

set ANT_OPTS=-Xmx2G -XX:MaxPermSize=512m

请参阅Increase memory for ant