Copyright (c) 2011 Doron Katz. All rights reserved. DoronKatz registered under ABN 68 954 062 611. Apple, the Apple logo, iPod, iPod touch, and iTunes are trademarks of Apple Inc., registered in the U.S. and other countries. iPhone is a trademark of Apple Inc. App Store is a service mark of Apple Inc. Theme by Cory Watilo

Filed under: Ant

"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">