Configuring Eclipse for Servlet and Flex Development

During the past few months I've been doing Flex and Servlet development in Eclipse on a WinXP machine and simultaneously on a Macbook Pro running Mac OS 10.4. The tools and set up are pretty much the same on Win and Mac.

For newbies, figuring out the correct tools to use and how to configure them can take a bit of time and a bit of guess work. It isn't always obvious from searches on the web which are the best options, and what information is up to date. I started capturing configuration details on an internal wiki, because we have a few people on my project at Adobe that have needed to simultaneously come up to speed on these procedures. I've publicly posted this information here to help others that may be in the same situation that I was a few months ago. This information dates from September 2007.

To post comments, please visit the blog entry for this article.

Installing Eclipse

Install the latest version of Eclipse from Eclipse SDK 3.3 is the current version. I use Eclipse Classic, which is equivalent to what the setup you used to get in v3.2.

A nice thing about Eclipse is that the eclipse folder is self-contained. So, if you bugger up an installation with various plug-ins or you need to run a different instance with a particular set of plug-ins, just unzip a new Eclipse folder instance. Of course on Mac most apps already have this nice characteristic :-).

Installing Java

If you are on Windows, install the latest version of Java SE (JDK 6 Update 2) from I let the Sun installer install this to the default location under Program Files.

My Macbook Pro came with Java pre-installed, so I haven't done a Java installation here yet. It also came with Perl pre-installed. And bash. And a terminal. And an assortment of unix command line tools.

Installing Perforce

We use Perforce at Adobe and I like running the perforce plug-in for Eclipse (called P4WSAD). Before installing the plug-in you will need to install the Perforce client tools including the command line tool (details not covered here). To then install the plug-in:

Once you have the plug-in installed you will have access to Perforce Help, under menu Help > Help Contents there will be an entry Perforce SCM, and a Perforce Perspective.

I will mention that I have had problems with the Perforce plug-ins that have caused Eclipse to quit on launch. Removing the Perforce plug-ins fixed the problem. Perforce is aware of this issue (I should add more details here on this issue when I can find the support email thread).

Another general hint for Perforce on a Mac laptop that roams on DHCP is to leave the Host field blank for your workspace.

Installing Flex

The Flex development environment for Eclipse is useful if you are doing Flex or AIR development and want an IDE with debug support, but it isn't free. You can get a trial version of the Flex 3 beta from

The Flex installer walks you through the installation process (win or mac). There are two downloads that you can choose, the standalone installer, and the Eclipse plug-in installer. Get the Eclipse plug-in installer, as it includes the standalone installer. It's a 200M+ download because it includes a complete copy of Eclipse but, since you've already installed Eclipse, you can choose to just add the plug-ins to your existing Eclipse installation.

Setup for Tomcat Servlet Development

The preferred way to use Eclipse and Tomcat together is with the sysdeo tomcat plug-in. This allows you to control and debug the tomcat server from within Eclipse. Stay away from the Web Standard Tools (WST) Project (v1.5.4). It's big and possibly a source of out-of-memory crashes. I had particulary bad luck trying to use this package, and was later advised by a more experienced servlet developer at Adobe to use sysdeo.

To understand Java servlets I recommend you get your hands on O'Reilly's Java Servlet Programming, Second Edition by Jason Hunter. Even though the 2nd edition dates back to 2001, it is still very relevant.


Install the latest version (6.0.13) of Tomcat from and unzip (eg. to c:\usr on Windows or /usr/local on Mac OS X). Apple has a good document describing how to install tomcat on a Mac OS X.

Install the sysdeo Tomcat plugin for Eclipse from Version 3.2.1 of these plug-ins works with Eclipse 3.2 and 3.3, as well as Tomcat 6.x. Follow the online instructions at this site, which will cause you to do no more then extract com.sysdeo.eclipse.tomcat_3.2.1 into your eclipse/plugins folder.


Configure tomcat development for Eclipse using Window > Preference > Tomcat on Windows, or Eclipse > Preferences on the Mac.

Creating a Servlet Project

Create an Eclipse servlet project (eg. MyProject) using File > New > Project and selecting Java > Tomcat Project.

Context XML files look like this:

    <Context path="/MyContext"
    workDir="PROJECT_ROOT\work" />

Associated with this new context, you must hand edit your PROJECT_ROOT/WEB-INF/web.xml file. You can add all your servlets from MyProject to this file. If you want to know anything more about web.xml files, check out the O'Reilly book mentioned above.

Sample web.xml file:

<?xml version="1.0" encoding="UTF-8" ?>
<web-app id="WebApp_ID" version="2.4"   xmlns=""   xmlns:xsi=""   xsi:schemaLocation="">
<display-name>My Demo Server</display-name>

For existing tomcat projects, you can determine the context name by right-clicking on the project from the Eclipse Package Explorer window, opening Properties > Tomcat and reading the Context name. I've gotten into the habit of editing context XML files by hand.

Note that a PROJECT_ROOT/work folder is required to exist, even if empty. It is needed in order for the project to compile, and it is referenced from MyContext.xml. Built files are sometimes output into this folder (eg. when using JSTL with servlets).

Adding Libraries to your Servlet Project

Libraries (i.e. jar files) will need to be added to your Eclipse project to allow it to compile and they will also need to be somewhere where they can be loaded by the tomcat server. One set up setp does not appear to cover both needs.

Adding libraries to an Eclipse project:

Exposing libaries to tomcat when not deployed as a WAR file:

Exposing libraries to tomcat when deploying a WAR file

More on Apache Tomcat Server Contexts

In my current research activity I have five different context files under the TOMCAT_HOME/conf/Catalina/localhost directory. Three of these are for individual servlet applications which run independently of each other. Another one I use for the debug convenience of serving Flash SWF files that are referenced by one of my servlet projects. This context file points to my FLEX_PROJECT/bin directory where my SWF files are output. The fifth context points to a documentation tree that I also serve from my Apache Tomcat server (I've recently switched to using Dreamweaver to write my documentation, as Framemaker doesn't run natively on the Mac).

I included a sample MyContext.xml file for servlets above. Here are sample context xml files for serving bin/SWF files (Win) and documentation (Mac). I'm not sure what role, if any, the workDir serves in this situation.

<Context path="/MyFlexProject" reloadable="true"
workDir="C:\dev\MyFlexProject\bin" />

<Context path="/myprojectname" reloadable="true"
workDir="/Users/jpravetz/dev/myprojectname/docs/work" />

Revision History

Created 3 September 2007 by Jim Pravetz from material collected internally at Adobe since June.