Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Importing external jars
Importing external jars [message #179572] Thu, 21 September 2006 14:42 Go to next message
Eclipse User
Originally posted by: aaron.esitenow.com

I don't quite understand how Eclipse imports external jars to the build
path. I have imported the jars, they show up in libraries in project
explorer, but it doesn't actually put the jars in web-inf/lib. Even
though I'm not getting any compile errors, Tomcat complains that it
can't find the classes. Do I need to manually import the libraries
myself for each library?
Re: Importing external jars [message #179581 is a reply to message #179572] Thu, 21 September 2006 15:09 Go to previous messageGo to next message
Eclipse User
Originally posted by: kosta.bea.com

Aaron,

You need to do a bit more work to tell WTP to package the jar into your
web app's web-inf/lib directory. I can walk you through that, but first
let me ask you a couple of questions:

1. Are you trying to avoid copying the jar directly into your web app?
If you are not trying to avoid it, the easiest thing to do is to simply
drag-n-drop the jar into your <pj.dir>/WebContent/WEB-INF/lib directory.
It will be automatically picked up and added to your project's classpath.

2. What version of WTP are you using?

- Konstantin
Re: Importing external jars [message #179631 is a reply to message #179581] Thu, 21 September 2006 18:45 Go to previous messageGo to next message
Eclipse User
Originally posted by: aaron.esitenow.com

Thanks for the reply. I'm not necessarily trying to avoid it, but I
always try to reduce the number of steps necessary to set a project up.
I just read about user libraries and that looks interesting, but I
don't know if that would solve my problem either. I am using WTP 1.5
and walking through some spring app tutorials.

Konstantin Komissarchik wrote:
> Aaron,
>
> You need to do a bit more work to tell WTP to package the jar into your
> web app's web-inf/lib directory. I can walk you through that, but first
> let me ask you a couple of questions:
>
> 1. Are you trying to avoid copying the jar directly into your web app?
> If you are not trying to avoid it, the easiest thing to do is to simply
> drag-n-drop the jar into your <pj.dir>/WebContent/WEB-INF/lib directory.
> It will be automatically picked up and added to your project's classpath.
>
> 2. What version of WTP are you using?
>
> - Konstantin
Re: Importing external jars [message #180618 is a reply to message #179581] Thu, 05 October 2006 09:37 Go to previous messageGo to next message
Niklas Lindholm is currently offline Niklas Lindholm
Messages: 4
Registered: July 2009
Junior Member
Konstantin,

I would be really interested in that walkthrough. I'm trying to avoid to
put a multitude of jar files in the WEB-INF/lib directory of each
project I'm having and instead having them in a separate area and
include them in the project via Subversion externals.

I'm using WTP 1.5 (soon 1.5.1 I guess..).

Thanks in advance.

/Niklas

Konstantin Komissarchik skrev:
> Aaron,
>
> You need to do a bit more work to tell WTP to package the jar into your
> web app's web-inf/lib directory. I can walk you through that, but first
> let me ask you a couple of questions:
>
> 1. Are you trying to avoid copying the jar directly into your web app?
> If you are not trying to avoid it, the easiest thing to do is to simply
> drag-n-drop the jar into your <pj.dir>/WebContent/WEB-INF/lib directory.
> It will be automatically picked up and added to your project's classpath.
>
> 2. What version of WTP are you using?
>
> - Konstantin
Re: Importing external jars [message #180648 is a reply to message #180618] Thu, 05 October 2006 11:16 Go to previous messageGo to next message
Eclipse User
Originally posted by: kosta.bea.com

Niklas,

Here is one of the better ways to do this:

1. Create a generic project (General->Project).
2. Copy your jars into this project and source control the project.
3. Whenever a web app needs to reference one of these jars, go to that
web app's project properties and use the "Add JARs" button on the J2EE
Module Dependencies page.

The jars will be automatically added to your web project's classpath and
now WTP will also know to package them into your WAR's WEB-INF/lib
directory when you export it.

If you don't want to create a project around your jars, then you can use
the "Add External JARs" (puts absolute paths into your project metadata)
or "Add Variable" (requires that the classpath variable that you use is
configured in every team member's workspace).

- Konstantin
Re: Importing external jars [message #181072 is a reply to message #180648] Fri, 06 October 2006 15:20 Go to previous message
Niklas Lindholm is currently offline Niklas Lindholm
Messages: 4
Registered: July 2009
Junior Member
Ah, the J2EE Module Dependencies setup is what I have been looking for!
Strange that I have missed it..

I don't have to create a new project or use any absolute paths (or setup
any variables). I just link my common jars directory in Subversion into
the project using an svn:externals property and then I can add the jar
files from that linked directory. (That, as far as Eclipse is concerned,
is part of the project)

Thanks!

/Niklas

Konstantin Komissarchik skrev:
> Niklas,
>
> Here is one of the better ways to do this:
>
> 1. Create a generic project (General->Project).
> 2. Copy your jars into this project and source control the project.
> 3. Whenever a web app needs to reference one of these jars, go to that
> web app's project properties and use the "Add JARs" button on the J2EE
> Module Dependencies page.
>
> The jars will be automatically added to your web project's classpath and
> now WTP will also know to package them into your WAR's WEB-INF/lib
> directory when you export it.
>
> If you don't want to create a project around your jars, then you can use
> the "Add External JARs" (puts absolute paths into your project metadata)
> or "Add Variable" (requires that the classpath variable that you use is
> configured in every team member's workspace).
>
> - Konstantin
Previous Topic:JSP validation
Next Topic:newbie can't get tutorial to work from eclipse
Goto Forum:
  


Current Time: Fri Aug 01 10:05:51 EDT 2014

Powered by FUDForum. Page generated in 0.02242 seconds