Configuring Eclipse for J2EE development

Posted on August 4th, 2009 at 12:01, in Code, How To, Java.

Starting to learn about Servlets and JSP from “Head First Servlets and JSP 2nd edition“, I have reached a level where just editing my files from gedit wouldn’t suffice, as typos began to generate frustrations on my side. Although this is the recommended way by the book authors to build your projects while learning, which I totally agree until some point, when you start to write more code this might become rather uncomfortable.

Because the book recommends Tomcat as a web container, I decided to use Eclipse as an IDE for this. Otherwise I would have probably went for JDeveloper, as it provides you an end-to-end developing framework. Anyway, to be able to develop J2EE applications using Eclipse, you must follow these steps:

  1. download Eclipse for J2EE from here and install it;
  2. download JDK (it has JRE included in it) if you do not already have it from here or install it from your repositories if you use Linux, like i do (I have installed both JDK 5 and 6);
  3. download Apache Tomcat from here (5.5 is the version recommended in the book) or install it from you repositories;
  4. open and configure Eclipse:
    1. go to Window – Preferences – Java – Installed JREs and add them from your install path (on Windows this is usually located in C:Program Filesjavajre, for Linux just check the screenshot):

      Configure JREs in Eclipse

      Configure JREs in Eclipse

    2. go to Window – Preferences – Server – Runtime Environments and add Tomcat from your install path (for Linux just check the screenshot for the usual path):

      Configure Tomcat in Eclipse

      Configure Tomcat in Eclipse

Now go on and build your applications!

Similar Posts:


One Comment

Anonymus Gravatar

Florin said

on June 6th, 2010,

at 22:28 hours

Somewhat off topic: you probably need to escape backslashes in windows paths with another backslash to make windows paths look proper – right now it’s C:Program Filesjavajre.

Think you've got something to say?

For leaving comments including source code or terminal output, please use the the following tags like in the next example:

[language]
code lines
[/language]
where you substitute language with the programming laguage used throught the code example (for terminal output that would be bash), e.g:
[bash]
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
[/bash]

To see a list of all the supported languages, please check this page.

If you want to include code bits inline, please use the code tags like in the following example:

The <code>$USER</code> variable holds the current logged in username.

Subscribe without commenting


Bear