Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » WTP and Tomcat container library
WTP and Tomcat container library [message #724300] Mon, 12 September 2011 01:46 Go to next message
sony  is currently offline sony Friend
Messages: 1
Registered: September 2011
Junior Member
I downloaded source code for a project which already had Eclipse config files like.classpath.

I created a new Java project in Eclipse and pointed the src folder to the downloaded directory.

I can't compile the project because of missing javax.servlet classes.

I looked at the Java Build Path and it looks as attached.
index.php/fa/3924/0/

Questions -
- I think the purpose of the org.eclipse.jst.j2ee container libraries was to include the servlet etc.dependencies to the build path. Why is there nothing underneath these container libraries?
- Do I need to start over and create a WTP project?
- If I do need to create a WTP project, can anyone please guide me how to get started on that? I could not find good information and instructions for it.

p.s. I know I can get away by adding the servlet jar to the build path, but I want to understand what the original developer was intending to do.

Thanks!

-
Re: WTP and Tomcat container library [message #724488 is a reply to message #724300] Mon, 12 September 2011 12:32 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2011.09.11 19:46, sony wrote:
> I downloaded source code for a project which already had Eclipse config files like.classpath.
>
> I created a new Java project in Eclipse and pointed the src folder to the downloaded directory.
>
> I can't compile the project because of missing javax.servlet classes.
>
> I looked at the Java Build Path and it looks as attached.
>
>
> Questions -
> - I think the purpose of the org.eclipse.jst.j2ee container libraries was to include the servlet etc.dependencies to the build path. Why is there nothing underneath these container libraries?
> - Do I need to start over and create a WTP project?
> - If I do need to create a WTP project, can anyone please guide me how to get started on that? I could not find good information and instructions for it.
>
> p.s. I know I can get away by adding the servlet jar to the build path, but I want to understand what the original developer was intending to do.
>
> Thanks!

There's a forum dedicated to this topic called Eclipse web tools. Here's
how I would answer:

First, I believe that the missing JARs will be provided by the inclusion
of a server runtime environment, i.e.: add to your workspace Apache
Tomcat, Glassfish, JBoss, etc. via Window -> Preferences -> Server ->
Runtime Environments. Do this first before creating the new project.

Second, you should attempt to import the project rather than create a
new one. Choose File -> Import -> General -> Existing Projects into
Workspace, then navigate to the subdirectory containing the .project,
..classpath, etc. files.

If that doesn't get you a new Dynamic Web Project in Eclipse, you'll
want to ignore those files and, as a last resort, create a Dynamic Web
Project and, instead of allowing the filesystem location to default to
the new project subdirectory in the workspace, use the control near the
top of the first page of the New Dynamic Web Project wizard to point it
to that downloaded source code.

On that same (first) page, there's a control the indicates which server
you will use. It's helpful to get that right, but there's nothing you
can't fix later if you botch it.

Third, right-click your new project, choose Build Path -> Configure
Build Path -> Libraries (tab), then Add Library... -> Server Runtime ->
Next (button) and select the server you wanted to use. Of course, if you
had to ignore the existing project and create a new one, all of this
Build Path stuff will have to be set up based on your knowledge of the
project (what you'd otherwise be getting from .classpath).

This procedure, or something close to it depending on what container
you're using, will get you what you want and it's more or less the
correct way, as I understand it, to accomplish this.

While this is not your case (if you find you can import the project),
here is an article I wrote detailing how to set up project source code
that didn't come with suitable project files (.classpath, .project, etc.):

http://www.javahotchocolate.com/tutorials/corejsf.html

Hope this helps get you going.
Previous Topic:Printing EMF GenModel Diagram Textually
Next Topic:Build commands available
Goto Forum:
  


Current Time: Thu Apr 25 14:05:41 GMT 2024

Powered by FUDForum. Page generated in 0.09912 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top