ATN compiling Java hints for insufficient resources

Source: Internet
Author: User
Tags stack trace

[Javac] system resources are insufficient for today's ant-Compiled project. The error, as follows

Buildfile:build.xml

-compile:
[Javac] Compiling 919 source files to E:/dshr/dshr/webcontent/web-inf/classes
[Javac]
[Javac]
[Javac] system resources are low.
[Javac] For more information, see the following stack trace.
[Javac] Java.lang.OutOfMemoryError:Java heap Space

It seems that there is not enough memory to set a larger

<target name= "-compile" >
< Javac srcdir= "${srcdir}" destdir= "${builddir}" memorymaximumsize= "500M" includes= "**/*.java" classpathref= " Class_path ">
<compilerarg value= "-xlint:unchecked"/>
</javac>
</target>
The following error occurred in the compilation
Buildfile:build.xml

-compile:
[Javac] Compiling 919 source files to E:/dshr/dshr/webcontent/web-inf/classes
[Javac] Since Fork is false, ignoring memorymaximumsize setting.
[Javac]
[Javac]
[Javac] system resources are low.
[Javac] For more information, see the following stack trace.
[Javac] Java.lang.OutOfMemoryError:Java heap Space

Since Fork is false, ignoring memorymaximumsize setting. This should be because the fork is false so I set the memorymaxmumsize is ignored, continue to modify
<target name= "-compile" >
< Javac srcdir= "${srcdir}" destdir= "${builddir}" fork= "true" memorymaximumsize= "500M" includes= "**/*.java" classpathref= "Class_path" >
<compilerarg value= "-xlint:unchecked"/>
</javac>
</target>
And then using ant to compile, passed.

Description: In the ant documentation (default is%ant_home%/docs/manual/index.html) you can see a number of tasks listed in the Ant tasks which javac in compile tasks
Click Javac to view more parameter information.

========================================================================================

Using the Javac command in ant, throwing a java.lang.OutOfMemoryError error is no different from a generic Java application. When executing the JDK's Javac command, the Com.sun.tools.javac.main.Main class is called in the%java_home%\lib\tools.jar package.      generally this problem is that the memory allocated by the virtual machine is not enough. For Ant, I've investigated some of the following two ways to resolve:     1) Set the Fork property at the Javac node, specifying Memoryinitialsize, Memorymaximumsize properties. Example:    XML code   &LT;JAVAC fork= "true" srcdir= "${basedir}/src" destdir= "${basedir}/build/classes" Classpath= "${project.classpath}" memoryinitialsize= "256m" memorymaximumsize= "256m" ></javac>     Description:    -fork: The fork attribute is not specified (false by default), the Javac command executes with ant in the same process, and Javac allocated memory is only 64MB. If you specify that the Fork property is True,javac the command will not execute with ant in the same process, the allocated memory size will be memoryinitialsize, memorymaximumsize the specified size.     -memoryinitialsize:javac the minimum memory footprint.     -memorymaximumsize:javac the maximum memory occupied.       2) The second method does not need to modify the Build.xml file, by specifying the virtual machine's memory at ant execution time, but then Ant and Javac will also be executed in the same process, in the method of [Ant_ Add set ant_opts= "-xms256m-xmx256m" in Home]\bin\ant.bat file 。       if the above two methods can not be solved, it is only the physical memory is too small, there can only be two ways to solve this problem, one is the simplest way to expand the memory, and the other project source file subcontracting compilation, but this is very troublesome, But there is no shortage of solutions.

Atn compiling Java hints for insufficient resources

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.