Eclipse

Eclipse is a powerful Integrated Development Environment (IDE) for several languages including Java.  You will need the Java EE version to create web servlets in Eclipse.

Creating a Web Application in Eclipse

From the File menu, select New -> Project... and create a Dynamic Web Application.  Name your project and specify "J2EE Preview" as the targeted runtime.  Leave everything else default.

Right-click on "Java Resources: src" in the Package Explorer window and choose New -> Servlet... and fill in the name of your servlet class.  Implement your code and Eclipse will automatically build it for you as you type.  Make sure there are no errors, then right-click on your project in the Package Explorer and select Export -> WAR...

You can then upload your WAR file to Tomcat using the Manager servlet.

Comments