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: Actionscript

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

How to work with FlexPMD

FlexPMD is one of those open-source projects in the thriving community that is Flex, that I find to be quite useful, especially for the enterprise world. Essentially, this tool, which could either be an eclipse-plugin, embedded within ant or through other third-party tools, is an auditor that aims to improve code-quality, traversing your ActionScript/Flex directories and spots out bad-practice code, with the ability to add your own custom rules.

It's sister tool which also comes in the package, FlexCPD, detects copy/paste code which might seem 'suspect' utilising theJavaCPD engine to detect such duplications. Upon running these tools, you get a detailed report in XML or charted via Hudson/Sonar, to assist in finding the code, realising the trends and so forth.

Read the rest of this post »