Adobe Flex in Ubuntu: Develop, Compile and Run

Flex on UbuntuRecently, browsing InfoQ I stumbled upon a very visual and interesting presentation by Christophe Coenraets “Rich Internet Applications with Flex and AIR“.

This presentation took place during QCon London 2008, where Christophe Coenraets, a Senior Technical Evangelist at Adobe, presented Flex and AIR, two technologies from Adobe used to create, deploy and run Rich Internet Applications.

I have not had any experience with Flex in the past, and, naturally, right after the presentation, I decided to give it a try – to develop, compile, and run an ultra simple Flex application. After some research, I found that there are two choices that are out there for Flex developers:

Adobe® Flex® Builder™ – software is a highly productive Eclipse™ based development tool enabling intelligent coding, interactive step-through debugging, and visual design of the user interface layout, appearance, and behavior of rich Internet applications (RIAs).


Adobe® Flex™ 3 Software Development Kit (SDK) – includes the Flex framework (component class library) and Flex compiler, enabling you to freely develop and deploy Flex applications using an IDE of your choice.

While Adobe® Flex® Builder™ is an appealing option, it is not free. It starts from $300, and goes up to $700 for a professional edition. Whereas Flex SDK is open source and free – which is “a bit” cheaper than $300. The biggest difference between the two is that with just SDK, I will have to use my own IDE / text editor to write Flex applications, which is totally fine by me.

Step 1. Download Flex SDK.

Go to download Flex SDK, and check the box with “I have read the Adobe Flex SDK License, and by downloading the software listed below I agree to the terms of the agreement.”, you should see the “Download the Flex SDK for all Platforms” link to a Flex SDK zip file. Download it.

Unzip it to any directory that you like (in my case it is /opt/flex-sdk)


Step 2. Create an alias to compile MXML, ActionScript, etc. Flex applications.

Make sure java 6 is installed:

sudo apt-get install sun-java6-jdk

I need to have JAVA_HOME pointed to java 5 (JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun), so I’ll hardcode the path to java 6 into flex compiler alias:

in ~/.bashrc:

# flex SDK home
export FLEX_SDK_HOME=/opt/flex-sdk
alias mxmlc='/usr/lib/jvm/java-6-sun/bin/java -jar "$FLEX_SDK_HOME/lib/mxmlc.jar" +flexlib="$FLEX_SDK_HOME/frameworks" "$@"'

re-login to the terminal (open a new terminal session). Now you can execute:

mxmlc youFlexApp.mxml

to compile an MXML file into an executable “youFlexApp.swf”

Step 3. Write a simple MXML application and compile it with Flex SDK.

Create a simple MXML file “flexTest.mxml”, that would create a button:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" layout="absolute">
        <mx:Button label="I am a simple flexy button" x="10" y="10" />

Compile it:

$ mxmlc flexTest.mxml
Loading configuration file /opt/flex-sdk/frameworks/flex-config.xml
/path/to/flexTest.swf (172884 bytes)

Now you should see a new SWF once the compiler is done:

$ ls -l
total 180
-rw-r--r-- 1 user group    217 2009-03-29 02:38 flexTest.mxml
-rw-r--r-- 1 user group 172884 2009-03-29 02:40 flexTest.swf

Step 4. Run compiled Flex application.

Open it with Firefox (make sure you have Adobe Flash Player plugin installed. If not, install it):

$ firefox flexTest.swf &

Now you should see that flexy button:

a simple button written in MXML and compiled by flex SDK

It is quite simple, really. Good Luck Flexing!


  1. Thanks!, quick and simple. Surprisingly basic to pick up, and exciting to start compiling some SWFs now :]

  2. Wonderful, thanks for taking the time to write a quick tutorial :) Time to learn Flex now :( Does this compile AS3 too?

  3. i would be thankful for u for this download

  4. Is there any sans-java way to make flex apps?

  5. Thanks! Great tip Toly! So I could build an SWF. But how to build AIR application now?

  6. First of all, I see that this “howto” is a bit out of date. But I tried to follow it…

    Everything was going fine, except that in the Ubuntu 10.04 don’t have sun-java6-jdk pkg to install (I use openjdk instead) and have it installed (openjdk-6-jdk, and some others pkgs)…
    So, to make the changes in ~./bashrc file I supposed to replace this part:

    for this:

    But when I tried to make the same .swf of the example, it failed and returned this message:
    $ mxmlc flexTest.mxml
    Unable to access jarfile /opt/flex-sdk/lib/mxmlc.jar

    I think I’m using the same paths that you, and follow all steps, except that part of JAVA_HOME, about java 5, since I only installed here java 6 (again, I suppose that was an unnecessary step)…

    Would be great for me if someone give me a little help…


  7. @Rodrigo,

    You can install “sun-java6-jdk” on Ubuntu 10.4 by adding these repos:

    deb lucid partner
    deb-src lucid partner

    I run Ubuntu 10.4, and:

    $ sudo apt-cache search sun-java6-jdk
    sun-java6-jre - Sun Java(TM) Runtime Environment (JRE) 6 (architecture independent files)
    sun-java6-jdk - Sun Java(TM) Development Kit (JDK) 6
    sun-java6-bin - Sun Java(TM) Runtime Environment (JRE) 6 (architecture dependent files)


  8. What about trace actions? is it possible to trace actions with this method?

  9. i run in the same problem:

    “Unable to access jarfile /opt/flex-sdk/lib/mxmlc.jar”

    and there was no mxmlc.jar file so i renamed the one from my language “mxmlc_de.jar” into “mxmlc.jar” but did not helped me. still getting the unable to access error.

    can anyone help?

  10. @Rodrigo try

    sudo chmod 0755 flex-sdk/ -R

  11. It is really nice and very helpful. Thanks for your time and quick help.

  12. Thank you for saving me the time to figure this out!!
    Very easy to follow tutorial, and worked exactly as advertised on my Ubuntu.

  13. sudo chmod 0755 flex-sdk/ -R did the trick for me in Ubuntu 11.10

  14. Thank you soooooo much for writing a very QUICK and comprehensive tutorial on how to setup Flex with linux.

tell me something...
  1. (required)
  2. (valid email - optional)
  3. Captcha
  4. (required)