1

I have a problem with my build path. In my web project all .jar must go on projects, so I cannot use the WEB-INF/lib resource to add .jars there.

So I created a Lib project so I could use it in the same way I use the WEB-INF/lib. Problem is I am not beeing able to make it work properly. Seems fairly easy, I create a Java project, put all .jar in it and then tell the build path to look at that project in the specific place I put this .jars.

I have tried creating other types of project (a non-java project an utility Java EE project...) and changing the native libreary location of the depended project. All futile.

So, How can I make one project see the .jar of another project?

Thanks for any help.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Random
  • 1,105
  • 5
  • 24
  • 37

3 Answers3

4

I'm not sure, but I think what you have to do is got to project>properties>build path>order and export and mark all the libs you want to pass through.

rsilva4
  • 1,915
  • 1
  • 23
  • 39
2

In your project properties under "J2EE Module Dependencies"/"Web Libraries" add your external jars there

Eugene Ryzhikov
  • 17,131
  • 3
  • 38
  • 60
  • I added the path to all .jars but it didn't work, so I tried adding each individual jar as a J2EE Module Dependencie Seems it's working. Thanks! – Random Jul 09 '10 at 08:43
  • Seems that this was removed in Helios and now this has to be done via the Deployment Assembly -- see this [thread](http://www.eclipse.org/forums/index.php?t=msg&th=172980&start=0&S=8e1b1230ca41777f3688d6396d0a2c58). +1 though for putting me on the right track. – Will Sep 23 '11 at 10:20
1

Using Maven would be a better alternative since it is actually a repo for jar files. Another alternative is to simply have a shared lib directory, then you configure your classpath to include the jar files at that location, preferably using a classpath variable to define its location.

There really isn't much point to putting them in an eclipse project, it adds no value. The other problem you have is that the jars are going to be required in the war at runtime, so without putting them in the lib directory, they will have to appear somewhere else that the classloader can find them, such as the servers classpath or some other shared location (this will be vendor dependent).

Robin
  • 24,062
  • 5
  • 49
  • 58
  • I understand the futility in my actions, unfortunatly it is not my decision. It's a 'corporate and arquitecture' decision. I understand we are shipping both projects. Funny thing is we are going to use maven to deploy... – Random Jul 09 '10 at 06:14