Home

"Java Space Error" Fix for Flex Developers

I thought I had to write this, at least for my benefit, but for others as well, who are trying to scour the internet to find the solution to this. The problem is, when using ANT and MXMLC, to compile your Flex projects, you get a "java heap space" error, similar to:

[mxmlc] Error: Java heap space 
[mxmlc] java.lang.OutOfMemoryError: Java heap space

 Everyone on the internet is talking about fixing it via changing Eclipse settings (well I don't use Eclipse) or via export console settings, like java .... but the simplest way I found, was to add the following (see red) in your ant build.xml file.

<mxmlc file="${src.dir}/${input.file}"
output="${build.dir}/${automation.file}"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="false"
keep-all-type-selectors="true"
fork="true" maxmemory="512m">