I use the Sysdeo Tomcat Plug-in for Eclipse while doing Java Web Application development. The main reason I use Sysdeo is that it allows hot-swapping of Java class files without a restart of Tomcat (and without losing Session information, which is the problem with most of the current Eclipse debuggers). There are limitations of course… you can’t change the interface of a class file without restart, for example. But for debugging and making hot code changes, Sysdeo is hard to beat. Sysdeo also allows you to modify JSP files without restart. And last but not least, it is free.
You don’t have to use Sysdeo to run the examples on Technological Oddity, but I recommend it for speed of development.
Installing Sysdeo in Eclipse
Note: These instructions are for Eclipse 3.5.1 ("Galileo"). Although they are similar for other versions, some menu options may be in different places for other versions of Eclipse. I do know that Sysdeo works as far back as the "Europa" build of Eclipse.
Files you will need:
- Tomcat 5.5. You will need to download and install Tomcat 5.5.x somewhere on your local system. Get the latest 5.5.x version (currently, that is version 5.5.28). You’ll only need to get the "Core" Tomcat package to use with Eclipse. You’ll only need to do this once ever, as you can use the same Tomcat installation for lots of different projects. Tomcat is easy to install: just unzip it into a directory and you are done. Remember where you installed it, as this is known as your TOMCAT_HOME (which you will need later).
- The Sysdeo Tomcat Plug-in for Eclipse. Currently, the version is 321. Unzip the files from this package into your ECLIPSE_HOME/plugins directory, and restart Eclipse. You should see a few buttons on your toolbar with the Tomcat "wildcat" icon. If you see these buttons, Sysdeo is installed correctly. In the end, you should have a directory ECLIPSE_HOME/plugins/com.sysdeo.eclipse.tomcat_3.2.1
- DevLoader.zip. This file is included inside the Sysdeo Plug-in ZIP file from above. Extract it out (or copy it from your local ECLIPSE_HOME/plugins/com.sysdeo.eclipse.tomcat_3.2.1/DevLoader.zip), then extract the contents of DevLoader.ZIP into your TOMCAT_HOME/server/classes directory. You’ll need DevLoader.ZIP so that Sysdeo can load your dependencies from inside Eclipse.
- The Sysdeo-Tomcat-Project. I’ve created this project to allow different instances of Tomcat to run off the same Tomcat base. In other words, I import this project into my workspace, and it becomes the Tomcat configuration for that particular workspace (after configuring Sysdeo, see below). This is NOT another full Tomcat instance. No matter how many workspaces you use this project in, there is only one c:\tomcat (for example). To install it, unzip the project into your workspace then import it with File > Import > Project. This project will make more sense when we configure Sysdeo a bit later.
Configuring Sysdeo in Eclipse
For the sake of instruction, let’s assume the following directories:
- Tomcat 5.5.28 is installed in C:\tomcat\
- Your workspace directory is C:\workspace\myworkspace\
These directories are merely examples. You can put Tomcat or your workspace wherever you want.
Make sure you have installed the files above in the "Installing Sysdeo in Eclipse" section, then start Eclipse.
Go to Window > Preferences. Select "Tomcat" from the list on the left to bring up the Sysdeo Plug-in settings.
Set your Tomcat version to "Version 5.x". Set Tomcat home to your TOMCAT_HOME directory (c:\tomcat in our example). Set Context declaration mode to "Context files", and set the Context directory to YOUR_WORKSPACE_HOME\Sysdeo-Tomcat-Project\conf\Catalina\localhost (which in our example is c:\workspace\myworkspace\Sysdeo-Tomcat-Project\conf\Catalina\localhost). Click "Apply" to save the changes.
Click the dropdown twisty next to Tomcat, then click on Advanced to see the advanced Sysdeo options.
Change Tomcat Base to YOUR_WORKSPACE_HOME\Sysdeo-Tomcat-Project\ (in our example this is C:\workspace\myworkspace\Sysdeo-Tomcat-Project). This change allows Tomcat to pick up configuration files (such as the server.xml file) from our project instead of from the normal location of TOMCAT_HOME. Therefore, we can use the Sysdeo-Tomcat-Project in lots of workspaces without the configurations or applications overwriting each other.
Click "OK" to save the changes and close the Preferences window.
Starting the Tomcat Server
Tomcat should start, and you should see the log files in your Console window inside Eclipse. To stop the server, either click the red square ("terminate") on the console window, or click the Stop Tomcat button.