Configuring Eclipse for J2EE development

Tuesday, August 4th 2009, 12:01

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!

You might also like:

1 Comment

  • 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.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


CODE EXAMPLES: When you want to include 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
    [/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.
	

Projects that I support

Recent Comments

  • nope said:
    yeah that was my first thought too, but: mount: warning: seems to be mounted read-write. too bad, would have been just perfect. more»
  • Klaus Deiss said:
    Dear Radu, I tried it on Ubuntu 10.0.4.2 and 10.0.4.3 with different kernel versions (amd64 server 2.6.32 kernel). No... more»
  • scompo said:
    Nope.. Now it’s not working again.. This printer it’s a real pain in the butt.. The other hp printer I had... more»
  • Dmitrij said:
    Thank you Peter and Patrice. Could you please post the updated script? more»
  • hd_flash_pains said:
    didn’t work for me more»

Recent Tweets

Bear