---
title: "Eclipse on Ubuntu for J2EE"
description: "Install or update Eclipse to have Eclipse Web Tools Platform (WTP). Practical notes and code examples on Eclipse on Ubuntu."
url: "https://h3manth.com/scribe/eclipse-on-ubuntu-for-j2ee/"
canonical_url: "https://h3manth.com/scribe/eclipse-on-ubuntu-for-j2ee/"
markdown_url: "https://h3manth.com/scribe/blog/eclipse-on-ubuntu-for-j2ee.md"
publishDate: "2008-11-27T00:00:00.000Z"
author: "Hemanth HM"
category: "cli"
tags: ["java","linux"]
word_count: 246
reading_time_minutes: 2
x_markdown_tokens: 515
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Eclipse on Ubuntu for J2EE

> Install or update Eclipse to have Eclipse Web Tools Platform (WTP). Practical notes and code examples on Eclipse on Ubuntu.

"Install or update Eclipse to have Eclipse Web Tools Platform (WTP)."

Eclipse can be configured on Ubuntu (8.4) as follows:

**1. Stop all apache and tomcat servers or any other if running on your host:**

```bash
/etc/init.d/apache2 stop
/etc/init.d/tomcatX.X stop
```

P.S: You need to be root or use sudo.

**2. Create a new dynamic web project:**

- Click on **New** > **Projects** > **Dynamic web project**
- Enter the name, click finish

**3. Add a new server on your localhost:**

- Click on the server tab
- Right click and select **New Server**
- Select **Basic** >> **J2EE Preview at localhost** (or any other appropriate for your need)

**4. Test your server by starting it:**

- Right click, start
- If any conflicts in the port, change the port of your local server

**5. Create a Servlet in your project directory:**

Try this ever famous "Hello World!!" (Add HTML Tags if required):

```java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorld extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
       
        out.println("Hello World!");
    
    }
}
```

**6. Right click on your server and select add or remove projects and add your current project**

**7. Run as >> Run on Server**

P.S: If you find any errors as cannot import `javax.servlet.*;` go to project properties >> Java build >> Add external jar and add Servlet.jar. I downloaded it from [here](http://www.java2s.com/Code/Jar/wsit/Downloadservletjar.htm).

**8. Learn, Run and be Happy :)**
