Ant Compiling in Flex Builder “Error: Java heap space”

July 10th, 2009 by Unknown Morphician

This week, I wanted to use Ant to compile a large project with a couple external libraries. Right after a few seconds of running my build.xml using Ant, I received this ugly message:

compile flex project:
[mxmlc] Loading configuration file C:\Program Files\Adobe\Flex Builder 3\sdks\3.3.0\frameworks\flex-config.xml
[mxmlc] Error: Java heap space
[mxmlc] java.lang.OutOfMemoryError: Java heap space

......

BUILD FAILED

Boooooo!

After consulting a couple of documents and search google, I found a solution that I decided to share. A lot of documentation states that you should change or add the environment variable ANT_OPTS to the particular size (Windows). This didn't work for me. The solution involves changing a particular property in Flex Builder. I really should thank Eric Fickes for his blog on this issue on Mac.  My solution is for Windows.

Go to Window --> Preferences

From the menu select Java -->Installed JREs

screenshot1

Select the VM and click the edit button. In "Default VM Arguments" enter "-Xmx512m" without quotes. This value may vary as well as performance.

screenshot2

Hopefully this makes your life a little easier.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • DZone
  • Fark
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • RSS
  • email

9 Responses to “Ant Compiling in Flex Builder “Error: Java heap space””

  1. [...] This week, I wanted to use Ant to compile a large project with a couple external libraries. Right after a few seconds of running my build.xml using Ant, I received this ugly message: compile flex project: [mxmlc] Loading configuration file C:Program FilesAdobeFlex Builder 3sdks3.3.0frameworksflex-config.xml [mxmlc] Error: Java heap space [mxmlc] java.lang.OutOfMemoryError: Java heap space …… Here is the original: Ant Compiling in Flex Builder “Error: Java heap space” [...]

  2. [...] This post was Twitted by CreativeTweet [...]

  3. levan says:

    nice one, :)

    but worth noting that this works only with eclipse integrated ant, it will not affect external ant,
    I personally use ant outside of eclipse from command line, it seems to run lot faster too .

    great find.

  4. “You can also get around this issue by running ant in the eclipse runtime instead of a separate runtime. It’s an option when you select your script and choose “Run as Ant…”.
    By
    Christopher Huyler Senior Software Engineer at LeapFrogRx

  5. Eric Fickes says:

    Thanks for the shout out Dennis.

  6. lalaine says:

    Worked for me! Thanks for sharing this solution.

  7. lance says:

    Hey, I am not seeing the Java or JSEclipse directories in Flex Builder, I’ve set everything up to, any ideas?

  8. Jason says:

    You can also create a new Environment Variable

    Variable: ANT_OPTS
    Value: -XX:MaxPermSize=128M -Xmx1024M

    Here is a link with details:
    http://www.ditainfocenter.com/eclipsehelp/index.jsp?topic=/ditaotug_top/installing/windows_settingenvvariables.html

  9. Arun says:

    Good Solution

Leave a Reply