- Download Eclipse IDE for Java EE Developers 3.4 Ganymede from the downloads section of the Eclipse web site.
- Extract the
eclipse-jee-ganymede-win32.zipintoc:\Java\eclipse. - Create a desktop shortcut to the Eclipse executable, for easy launching.
- Download Tomcat 6.x from the downloads section of the Tomcat web site.
- Launch Eclipse.
- On a new install of Eclipse it asks you where you want to put your workspace.
- Next we are going to install Spring IDE.
- Restart Eclipse.
Installing Spring IDE
- From the menu: Help->Software Updates
- Click Add site…
- Enter the the Spring IDE update site url: http://springide.org/updatesite/site.xml
- Click Ok
- Check the box next to Sprint IDE Update Site
- Expand Sprint IDE Update Site
- Expand Dependencies
- Uncheck Spring IDE Dependencies (only for Eclipse 3.2.x)
- Expand Integrations
- Uncheck Spring Mylyn Integration (optional)
- Click Install
- Screen will show no unresolved dependencies
- Click Next >
- Select I accept the terms of the license agreement
- Click Finish .
Configure Tomcat inside Eclipse
Next we need to tell Eclipse about which Tomcat we are using and set up the integration.
- From the menu bar select Window->Preferences.
- The Preferences window will open. Expand Server.
- Highlight Runtime Environment. This is the place where you can tell Eclipse about where you put your Tomcat installation.
- Click Add.
- Expand Apache and select Apache Tomcat v6.0.
- Check the Create a new local server check box to create a new server in the Servers view.
- Click Next.
- Leave the Name of the server set to Apache Tomcat v6.0.
- Eclipse gives the option to download a version of Tomcat but it usually does not have the latest version (which is why we downloaded it separately). Click Browse and navigate to
c:\java\tomcat and click Ok. - Leave the JRE drop down set to Workbench default JRE.
- Click Finish.
- You are taken back to the Server Runtime Environments preference page so click Ok.
- A new project will have been created and if you go into the Servers view (in the bottom set of tabs), you will see a new server Apache Tomcat v6.0 at localhost.
Create project
There are several different types of project in Eclipse and we need the one that will allow us to integrate all the things we need.
- Select File->New->Dynamic Web Project
- Enter a Project name. Although you can have spaces, in my opinion, it’s best not to put any in. The project name becomes the directory name and for the same reason as above it’s a pain if there are spaces.
- The Target Runtime should already be set to Apache Tomcat v6.0.
- Also keep the Configuration set to Default Configuration for Apache Tomcat v6.0.
- Click Finish.
- In the Project Explorer, right click on the new project and select Spring Tools->Add Spring Project Nature.
Spring Web project and Tomcat project association
We must now associate the project with Tomcat.
- Make sure the Servers view is visible (in the bottom set of tabs). Highlight your new Spring Web project and drag it on to the Tomcat v6.0 Server at localhost entry in the Servers tab.
- We want to use the Tomcat server when we use our new project, so we can set the Server project to be a dependency of our new project. This will mean that when we open our project the Server project will open automatically.
- Right click on our project and select Properties.
- Select the Project References option and check the Servers project.
- Click Ok.