views:

332

answers:

2

What's the easiest way for me to get Eclipse running with a Java servlet container on Ubuntu 9.10?

I've tried a number of things, hitting dead ends each time. The best setup would use Ubuntu packages as much as possible, not require running Eclipse as root, and be able to debug running servlets.

Dead ends so far include run-jetty-run, the Sysdeo Tomcat plugin, and Eclipse WTP with tomcat6.

A big part of the problem is that the Ubuntu tomcat6 installation is non-standard, splitting directories such that they're not all in TOMCAT_HOME. Eclipse is also non-standard, and the usual plugin installation methods don't work. I got close by installing the WTP through a PPA, but I stumbled when trying to get it to recognize tomcat.

+1  A: 

Ubuntu recently includes a pretty full Eclipse package that you can install via Synaptic or such. But I prefer to download my own.

I download from the Eclipse download site. If I choose Eclipse IDE for Java EE Developers then I have server environments for all Web app containers already built in. If I set up one for Tomcat (in Eclipse), Eclipse will download and install Tomcat for me. It's quite convenient, although I sometimes have trouble finding Tomcat or its files. Eclipse squirrels them away somewhere.

The server setup menus become accessible to you once you create a Web project (not plain Java project).

Carl Smotricz
That squirreling is however configureable by *Tomcat in Server View* > *Server properties* > *Server Locations* > *Use Tomcat Installation* (instead of workspace metadata). A custom location is also an option.
BalusC
True enough, and this is what I usually do. But this requires me downloading Tomcat separately, and I think Eclipse still puts web apps in a separate directory that's not $CATALINA_HOME/webapps. So there's still a little mystique involved, but not so much as to bother me in my daily work.
Carl Smotricz
A: 

You should "apt-get install sun-java6-jdk", download and use the JEE version of Eclipse, and then create a dynamic web project. In the web project create a jsp page, and right click -> "Run -> Run on server" where you may then install a server connector.

Some connectors are included in JEE, some must be downloaded. Choose the one corresponding to the server you have downloaded and unpacked, and point Eclipse to the directory.

If all succeedes, the JSP page should then show up in a browser served from the started server.

Thorbjørn Ravn Andersen