The system is out of resources when building Apache FOP
When trying to build Apache FOP by ant on the command line, it complains:
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] ...
[javac] at com.sun.tools.javac.main.M开发者_运维知识库ain.compile(Main.java:353)
I don't understand. I have enough RAM, how can the system run out of resources?
You need to give more memory to your JVM. e.g. the below allocates 512Mb to the JVM.
javac -Xmx512m ...
The Java virtual machine runs with a fixed maximum memory size. For memory-intensive operations you need to increase this appropriately. -Xmx
specifies the maximum amount of memory the JVM will take. -Xms
specifies the amount of memory the JVM allocates on start-up.
There's a nice summary of options here.
Note: Given the above occurs via Ant, you may need to increase the memory available to Ant (e.g. set ANT_OPTS=-Xms256M -Xmx512M
), and/or the memory available to your javac
process if that's being forked as a separate executable.
the size of your system memory is only half of the story, the JVM allocates a memory chunck as a heap space when it starts up. the java compiler as a java application has only this amount of memory to work with
you can set the heap size for the java compiler yourself with this option
javac -J-Xms<size>m
see the complete switches sets here
精彩评论