Wednesday, January 18, 2012

Setting up tomcat with Eclipse

 

image image image

In this “How-To” feature, I will show you ‘How to setup Tomcat 6.x with Eclipse’. Eclipse is one of the most popular IDEs for Java out there. Being free and open source, it is supported actively by the Java developer community. Also helping its popularity is the N number of plugins supported by eclipse.

Tomcat is a server container of choice among many development environments and provides a small footprint to test out and develop the web based applications.

Together, these two provide a handy, fast and stable development environment exhibiting years of mature stability and ease of usage.

Hit the jump for ‘Setting up tomcat with Eclipse’.

Setting up tomcat with Eclipse

In this “How-To” feature, I will show you ‘How to setup Tomcat 6.x with Eclipse’. Eclipse is one of the most popular IDEs for Java out there. Being free and open source, it is supported actively by the Java developer community. Also helping its popularity is the N number of plugins supported by eclipse.

Tomcat is a server container of choice among many development environments and provides a small footprint to test out and develop the web based applications.

Together, these two provide a handy, fast and stable development environment exhibiting years of mature stability and ease of usage.

Follow the below steps in order to be up and running with the Eclipse with tomcat setup.

1. Install appropriate version of Java – Use http://java.sun.com/javase/downloads/ to download the version you require (Java 5 or 6 version should be enough). Please download the full JDK (with compiler).

2. Get a local copy of the Tomcat Server – Get the Tomcat 6 version from the Tomcat Web site.

3. Download, extract and start Eclipse. Download from http://www.eclipse.org/downloads/. Choose "Eclipse IDE for Java EE Developers", download, and unzip. I am currently using the Eclipse 3.6 (Helios) but any version should be OK.

Launch the eclipse.exe from the extracted eclipse folder and start the "Workbench".

4. Start Eclipse configuration –

1. Press Ctrl+N or choose New from File Menu;

2. Select New Server;

3. Select the server version as your Apache Tomcat version;

4. Click ‘Add’ and then browse to Tomcat installation folder (e.g., C:\apache-tomcat-6.0.28);

5. Select Finish.

clip_image002

5. Start the Tomcat. Select the ‘Servers tab’ from the TABS visible in the bottom panel. Right click and choose ‘start’

clip_image004

6. Launch the browser, open the http://localhost/ and you should be seeing something running off the Tomcat server.

7. Create your web application for testing tomcat – Create a New Project

(Select New – project – Web – Dynamic Web Project).

clip_image006

8. Copy desired resources, web files (HTML/JSP / etc.). Configure this project’s runtime as the new tomcat server.

clip_image008

We assume this project name as WEBAPP.

9. Deploy this as a web project for tomcat using the following steps

  1. Select the newly created Tomcat X Server in the server TAB,
  2. Select "Add and Remove Projects".
  3. Select WEBAPP project.
  4. Start / restart Tomcat.
  5. Test the new WEBAPP in browser as – Open http://localhost/ WEBAPP/

That should have you up and running with the Tomcat Application server (via Eclipse). I hope it comes out to be useful to you budding developers out there!

Coming up soon is the “how to set up a web-service project in Eclipse/Tomcat”.

Stay tuned, and feel free to share your insights and helpful comments below!

No comments: