Sunday, November 15, 2009

Start and Stop Tomcat from within the Eclipse IDE

Starting and stopping Tomcat from within the Eclipse IDE, once set up, can speed up your Java Web Application development time because you won't have the extra step of opening the terminal to start and stop Tomcat. The following instructions assume you have Eclipse installed and Tomcat installed.

Step 1: Open up the External Tools Configurations in Eclipse. In Eclipse's toolbar click on the little icon with a run symbol and the toolbox, then External Tools Configurations... .



Step 2: In the dialog box that pops up, right-click on Program and select "New".



Step 3: Give the new run configuration a name such as "Stop Tomcat", and in the "Location" text field enter "/Library/Tomcat/bin/shutdown.sh". You need to adjust the path of the shutdown.sh to match the file's location on your computer. Also, if you're using a Windows machine you need to call shutdown.bin instead. Click "Run".



Step 4: Create another configuration for starting Tomcat be repeating steps 1 through 3.

From now on, starting and stopping Tomcat as well as building your projects is accessible with a click of the mouse. Just click the little down-arrow next to that icon with a run symbol and the toolbox, and you'll see a list of the run configurations that you have set up.



Piece of Cake!!

3 comments:

Anonymous said...

It says CATALINE_HOME isn't defined correctly. Where do I define that from inside eclipse?

Tim Molter said...

My guess is that somewhere in shutdown.sh or startup.sh, there is a variable called CATALINE_HOME that isn't defined correctly. That isn't a problem related to running that script in Eclipse. Good luck!

Anonymous said...

I had this problem and solved it by setting the working directory in the run configuration.