A Look at Flex 3.0's Java-based Compiler API

| by Bryan Clauser Follow 0 Followers on Jan 31, 2008. Estimated reading time: 1 minute |

Integrating Java and Flex has proven challenging in some cases. Adobe is trying to make things easier with its release of Flex 3 which includes a Java-based compiler API. This API lets you compile SWF and SWC files from Java applications, supporting the same options as mxmlc and compc command-line tools.

The underlying concept relies on Java developers creating Flex Application objects. These objects represent a Flex application, and are built by and setting its mxml as well as its output and building it:

Application application = new Application(new File("../apps/TestApp.mxml"));
application.setOutput(new File("../apps/TestApp.swf"));
long result =;

Some of the highlights of the Flex Java API are:

  • Generate reports and provide information such as progress and logs during the compilation process as well as reports about the application, library, or project that you are compiling

  • Incremental compilation that is more efficient because it only recompiles the virtual file that was changed and not all files that are in the application

  • The capability to create application and library source files at run time and to compile these files into applications and libraries.

  • Create Flex applications in memory and compile them to SWF files without ever having an MXML file on disk.

There are already some tools that can help out Java developers wanting to build Flex applications. Antennae, a set of templates for building complex Flex projects with Ant has been available for some time now. Also based in mxmlc and compc, Antenne gives developers another means for intergrating Flex into their Java projects.

The Flex 3 Java-based compiler API can be found here.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

What is the big deal by Matt Giacomini

I have been building Flex applications with ant using flexTasks since version 2. Allows me to include flex applications in my build.xml so java and flex build together. I think it would be great to have incremental compilation, but other then that I don't see what the big challenging is?

Yes having the linkage reports would be nice too.

Re: What is the big deal by 龙 张


3 news by Sandeep Khurana

Is Flex such a popular technology that there are 3 news about it on Infoq today? Is it the time i should start looking into it? Any idea about the job market of Flex?

Re: 3 news by Matt Giacomini

I don't think it is that flex is "that popular", but they have been making a lot of changes and upgrades to the framework, plus offering more of it for free (some parts are open source). There has been quite a bit happening in that space lately. That and the fact that RAI's are getting a little more attention these days.

Re: 3 news by robin bajaj

As an Enterprise java developer (strongly interested in using Flex in my next J2EE project) I think the following factors will play against Flex's adoption in today's proactively open-source Java world)
a) non-free Flex plugin for eclipse (299 USD without charting and 699 USD with Charting component, given the fact that a lot of very good eclipse plugins are available for free or are are available for under 50 bucks (like MyEclipseIDE))
b) having to buy FDS (flex data services) license for deploying it as an integration bit to any J2EE appserver deployment.Although there are other alternatives available but they don't perform as well.

Quoting Yakov Fain (well known Flex Evangelist) from his article(
While you can use Flex just to connect to your existing applications written as JSP or any other HTTP-compatible technologies, you’ll get performance gain if you’ll use Flex remoting and messaging that is build on fast Adobe proprietary protocols called AMF3 and Real Time Messaging Protocol (RTMP). To take advantage of these benefits you have to purchase Flex Data Services licenses, while may not be affordable for small businesses.
I think once these bounds are removed, Flex's adoption in the Java Enterprise world will increase rapidly as a strong RIA alternative. Just my 2 cents.

Re: 3 news by robin bajaj

And before someone points me to #5 in the top 10 Flex misconceptions (
I would mention that I did read this article. But my point is, Flex can become
more attractive to small java shops (like mine) if its pricing (*with charting and FDS license(100 concurrent users)) comes down to around 100 USD.
I am a Flex fan (*from the looks of it) but would like the pricing to be adjusted a bit more before using/promoting it in my network.. I hope ADOBE product management is reading ;-)

good news (Free alternative for Flex Builder is in the making..) by robin bajaj

Good News - Free alternative for Flex Builder is in the making..

Also a free alternative to Flex Data Services - GDS (Granite Data Services) is also been announced here on infoq. Its available @

Good stuff going on in the Flex/RIA market. I am excited to see how things unfold in the near future... who knows if Adobe notices there are competitive (FREE) alternatives popping up to Flex builder, they might make it free (or at least cheaper ... :-)

Re: good news (Free alternative for Flex Builder is in the making..) by srini bags

I have found this interesting blog ( explaining a couple of eclipse plugins that helps building Flex applications for free.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

8 Discuss