I seem to be missing something obvious, but I can't get an external JAR
to be recognized at runtime when using eclipse 3.1.2 and wtp 1.0.1. I
have some servlets which import a 3rd party .jar file.
When I right-click my project, select properties, click Java Build
Path, select the Libraries tab, and click the Add External JARs button,
I am able to add the JAR and the servlets are compiled successfully.
However, when I attempt to run the web app, using Tomcat 5.5.16, I get
the notorious ClassNotFoundException.
The ONLY way I've been able to overcome this runtime issue is by
manually copying the JAR file to the JVM's runtime externals directory
- on my WinXP box that's c:\java\jre1.5.0\lib\ext.
Great that I've found a work-around, but surely there's something I can
do within eclipse to make these JARs available to tomcat at runtime.
Suggestions?
chris brat - 19 Apr 2006 14:41 GMT
Hi,
As far as I know with Tomcat you either have to copy to the external
jars to the common library location (think its /shared/lib/**) or have
the external libs included in your war (guessing you build your package
into a war) under the /WEB-INF/lib directory.
I generally keep my external libs under the WEB-INF directory - this
makes the package larger but at least I know that my libs are there and
will always be the right version.
Hope this help,
Chris