Setting Up Eclipse For Flex 2

Back in 2005 Darron Schall posted Setting Up Eclipse For Flex. A great article, but with the release of Flex 2 it has become a little outdated. I took some time this weekend to set up Eclipse for Flex 2 and thought I'd revise Darron's post a bit to bring it up to speed for those of us who don't generate the revenue to justify Flex Builder but still like to play with it (aka are too cheap to buy it). So here are the steps to get Eclipse up and running. Don't forget that the Flex 2 SDK is completely free so you now have no excuse for not getting into Flex anymore :)

The following steps assume that you're already running the latest version of Eclipse.

Step 1

Download and install the Eclipse Web Tools Platform. As of this post the current version is 1.5.3 so that's where the download link above will take you. Go here if you want to check for a newer version. You really just need the Web Standards portion to set Eclipse up to edit .mxml files - so don't worry about the J2EE project (unless you really want that).

Here's a complete list of files to download.

  • emf-sdo-xsd-SDK-2.2.2.zip
  • GEF-SDK-3.2.2.zip
  • JEM-SDK-1.2.3_jem.zip
  • wtp-wst-R-1.5.3.zip (or the complete Web Standards Tools download)

Step 2

Unzip and copy the contents of each package into Eclipse's Features and Plugins directories respectively. The Web Standards Tools are now installed (well, assuming you've restarted Eclipse if you had it running).

I'm going to borrow some of Darron's original post from here and modify as appropriate:

Now that the appropriate plugins are installed, we need to configure Eclipse to recognize .mxml.

Start Eclipse

From the menu, select Window -> Preferences. Select General -> Content Types. On the right, expand Text and highlight XML. Click the "Add" button and enter "*.mxml" as the file type. Click OK.

Still in the Window -> Preferences menu, expand "Web and XML" and select "XML Catalog". Click "User Specified Entries" and click "Add" and use the following values.

* URI: browse for the path to the mxml.xsd file (something like: C:\Program Files\Macromedia\Flex\extras\schema\mxml.xsd) Updated from original post: The mxml xsd does *not* ship with the Flex 2 SDK. Tom Chiverton has updated the 1.5 xsd for Flex 2 (available here) but it is not 100% updated. I exchanged emails with Tom yesterday and he did say that he had a new version that he will post online soon. Hey Adobe...we really love your product...can you please give us the xsd??? :)

* Key: Edited from original post http://www.adobe.com/2006/mxml

Click OK to close the preferences window.

That's it! Eclipse should now recognize any tags using the mx: namespace (well, all those that are in the xsd that is) and will give you the appropriate mxml code hints as you code. One catch - thanks Tom for pointing this out - is that when you're within a tag (IE <mx:Button>) you'll need to hit CTRL+Space to bring up the attribute hints.

So I hear you saying "That's great! I can now code Flex applications without Flex Builder a little easier. But how can I compile them easily?" Well there are several ways to do that, but that's another post :) I am also working on a tool to help manage small Flex projects that will help you compile and generate HTML wrappers (without messing with ANT).



Related Blog Entries

Comments
this is soo great - thx a lot man !
# Posted By Carsten | 4/5/07 3:03 AM
Thanks Buddy, You have done a gr8 job for all Flex Learners & enthusiasts.
# Posted By Kuldip D Gandhi | 4/24/07 2:44 AM
How can We Compile mxml files from Eclipse?
# Posted By Kuldip D Gandhi | 4/24/07 5:49 AM
Yeah, give us an hint on compiling :)
# Posted By chris | 4/24/07 7:22 AM
# Posted By todd sharp | 4/24/07 9:15 AM
Thank man! one day a free eclipse plugin will see the light!
# Posted By denix | 5/3/07 9:34 AM
For those using MyEclipse you can find the XML Catalog under Window -> Preferences -> MyEclipse -> Files & Editors -> XML -> XML Catalog
# Posted By Tom | 5/8/07 12:37 AM
I am using eclipse 3.2.2 and can't for the life of me find the Window -> Preferences -> Web and XML - I can't seem to find the XML Catalog at all - am I missing something completely?
# Posted By Travis | 5/16/07 12:37 AM
Travis i seem to have the same issue. I spooked around the IRC channel a bit and finally got a way to get that "Web and XML" entry..

First, I have Eclipse 3.2.2. I downloaded 'EMF' (http://www.eclipse.org/modeling/emf/downloads/?pro...
Get version 2.2.3! (Not 2.3.0!).
Then I could install 'WST' using the Help-> Software Updates .. -> .. Callisto and then the last entry. Click the button that checks requirements.

Once this is all finished I have the 'Web and XML' entry.
# Posted By ArmEagle | 6/6/07 4:34 PM
Oh.. wait.. i guess i had downloaded too high versions of the files all the time.
# Posted By ArmEagle | 6/6/07 4:36 PM
I could not find Window -> Preferences -> Web and XML either and I was using eclipse 3.2.2. To fix this make sure you install all the files listed at the beginning of the article (eg emf-sdo-xsd-SDK-2.2.2.zip, etc)
# Posted By Carl | 6/25/07 3:29 AM
Great work. Works fine for me.

One Question:
I'm looking for a actionscript plugin (syntax, hints, etc.) for eclipse that works in combination with your flex plugin.

If I use this one:
http://sourceforge.net/projects/aseclipseplugin/
there is no syntax hightlighting of as - code in *.mxml files.

Do you know a solution?

Thanks a lot for your work so far.
# Posted By Andreas | 6/27/07 8:19 AM
Ok, so if you use the latest and greatest, of eclipse, you can install oxygen for free from here (see the eclipse install) http://www.oxygenxml.com/download.html

Hope this helps
# Posted By Jeremiah LaBresh | 7/21/07 1:18 AM
I use eclpise3.3, how to get "Web and XML"?
Thanks!
# Posted By calif | 8/5/07 7:24 PM
Calif - I'm running 3.3 and had no problems - are you sure you installed all of the correct files listed above?
# Posted By todd sharp | 8/7/07 11:38 PM
Doesn't work for me. I've installed it all twice, carefully.

Even though I browse to the .xsd file, if I shut the preferences window and re-open it, I get a message in red saying that the .xsd file can't be found. This is because Eclipse changes the path to the .xsd file to something that actually can't be found. No matter where I put it, it can't find it.

So after all this effort, eclipse is about as useful in this context as Notepad.
# Posted By joolz | 9/1/07 7:15 AM
Hi Todd!

Thanks for the tutorial. I tried it, but it seems as if something went wrong. I get no syntax highlighting and no code completion when opening/editing an mxml file.

I installes the WTF through the plugin manager directly in eclipse.

Do you know what could be the problem?
# Posted By Marian | 11/29/07 6:13 AM
It's not working... I get

java.lang.NullPointerException
   at org.eclipse.wst.sse.ui.StructuredTextEditor.update(StructuredTextEditor.java:3047)
   at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.addSourcePage(XMLMultiPageEditorPart.java:338)
   at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.createPages(XMLMultiPageEditorPart.java:505)
   at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:276)
   at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:596)
   at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:372)
   at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
   at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:290)
   at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:140)
   at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
   at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
   at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:394)
   at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1144)
   at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1097)
   at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1311)
   at org.eclipse.ui.internal.PartStack.add(PartStack.java:455)
   at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:102)
   at org.eclipse.ui.internal.PartStack.add(PartStack.java:441)
   at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:111)
   at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:60)
   at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:217)
   at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:207)
   at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:822)
   at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:721)
   at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:682)
   at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2593)
   at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2528)
   at org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPage.java:2520)
   at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2505)
   at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
   at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2500)
   at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:288)
   at org.eclipse.ui.actions.OpenWithMenu.access$0(OpenWithMenu.java:280)
   at org.eclipse.ui.actions.OpenWithMenu$2.handleEvent(OpenWithMenu.java:184)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
   at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
   at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
   at org.eclipse.core.launcher.Main.run(Main.java:977)
   at org.eclipse.core.launcher.Main.main(Main.java:952)
# Posted By Q | 12/16/07 3:03 PM
The last post looks like the error you would see if you tried the ASDT plugin 090beta and tried to open as AS file outside of an ActionScript project before specifying the core classes location.

Try specifying the core classes location (under Windows-Preferences, ActionScript2, Core path). If you have flex2 sdk specify the lib directory.

Then change to ActionScript2 perspective and create a project then move your AS sources there and try to open from your project.

The other exception you would see if you used the ASDT 085 release is a ClassCastException under the same circumstances. If you set the core path and open the files under a project then all is well. At least with Eclipse 3.3
# Posted By JonR | 12/24/07 4:18 PM
hi , this is bizzare and no one seems to have run into it so far. I've installed eclipse europa 3.3.1.1 and eclipse wtp but when I try to install flex 2.0 with eclipse plug in, flex installation is unable to recognize the directory of flex installation . I just get an error message saying "eclipse verion 3.1 or higher must be installed" . Eclipse installation seems to be fine tough. Any help in resolving this is appreciated.
# Posted By madhav | 1/24/08 9:50 PM
Hi, I am also facing the same issue as madhav is... can you help us out please.
# Posted By Arpan | 2/6/08 4:54 AM
I am having the same issue with installation. Did anyone resolve this?
# Posted By guns | 2/15/08 6:04 PM
I too am having the same problem as madhav. If anyone has any info it would be much appreciated.
# Posted By Brian | 2/15/08 6:36 PM
Hey thanks for the resources, I'm trying to learn Flex having some difficulties but this has helped. Good article
# Posted By Firebubble Web Design | 7/14/08 7:03 PM
I made all the changes and steps suggested in the post, but I am not getting code completion/ hints. I am not sure, but do we get those features by following the post?
# Posted By chin | 8/17/08 5:28 AM
Did you try CTRL+Space?
# Posted By todd sharp | 8/17/08 12:06 PM
For those of you using Eclipse 3.3.2 and have problems finding the "Web and XML", pleasse follow all the prerequisites found in the following URL http://download.eclipse.org/webtools/downloads/dro... . Install the mentioned JEM-SDK-1.2.3_jem.zip.
And that's it. The "Web and XML" should appear.
# Posted By nipt | 8/31/08 11:02 AM
i have spent over 12 hours trying to figure out how to set up Eclipse for Flex. First the Eclipse download site is so confusing. Which files does one download? Then how to add a Flex plugin to Eclipse? Where is the Flex plugin. You do not tell how to get these files!
# Posted By going crazy | 10/30/08 9:22 PM
Do you know if instructions for plugin of Flex builder 3 are the same as these ones?
# Posted By Berna | 2/5/09 4:03 PM
Hello,
I have Eclipse 3.2.2 and i am trying to intergarte plugin of Flex 3. So can u giide me which plugin required and also where the mxml.xsd file is present?

Please reply this......
# Posted By Shilpa Desai | 2/6/09 12:44 AM
# Posted By todd sharp | 2/6/09 9:43 AM
thnx for mxl.xsd help. Now i am little bit confused about how to crate new project in eclipse about flex...if you have any link or tutorial please suggest me
# Posted By Shilpa | 2/13/09 8:42 AM
Hi,

I am tryig to run my project using Ant build (apache-ant-1.7.1-bin.zip) with flex 2 sdk and eclipse 3.2.2. But it throwing one error like below
:
:[exec] Loading configuration file C:\Program Files\flex_sdk_2_194515\frameworks\flex-config.xml

[exec] Error: unable to open 'Workspace\Flex\test.mxml'

[exec] Use 'mxmlc -help' for information about using the command line.

BUILD FAILED
D:\Flex Workspace\Flex\build.xml:5: exec returned: 1

Ant build is running as i have tested from command prompt.
Please suggest me why this error is coming?????
# Posted By Shilpa | 2/16/09 6:15 AM
i got web and xml entry but it is not displaying anything for xmlcatalog in right pane what should i do?? so that i can set the user entries for xml catalog
# Posted By akhil agrawal | 2/18/09 4:50 AM

Calendar

Sun Mon Tue Wed Thu Fri Sat
   1234
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Subscribe

Enter your email address to subscribe to this blog.

Tags

actionscript ajax blogging cfsnippets coldfusion flash forms flex funny stuff javascript misc model-glue off topic personal project learn slidesix sql

Recent Comments

Chinese Birth Calendar Accuracy Test
mama to be said: ok so i will be 2 months shy of 18 when i have my baby. this calendar does not technically work for ... [More]

Fixing 'User Profile Service Failed The Logon' on Vista
Mike said: That fix worked although all i did was remove .bak and reset state to 0. User was able to log in to... [More]

Chinese Birth Calendar Accuracy Test
Melissa said: Wrong for my daughter, which it predicted to be a boy... we'll see for #2. Predicts a girl (maybe, f... [More]

Adding Auto Generated Code Downloads to BlogCFC
fweerw said: http://www.ibiblio.org/st... http://www.cambodia.ait.a...... [More]

Check Out The New SlideSix
Todd Sharp said: Thanks for the feedback Ben & Rachel! I'll keep it all in mind as I tweak things over the next ... [More]

RSS


adobe community experts

coldfusionbloggers

FullAsAGoog MXNA

Consumed By Feed-Squirrel.com