Link to home
Create AccountLog in
Avatar of deltaecho
deltaecho

asked on

Adding jar file to lib using eclipse

I'm trying out hibernate and I keep getting a: NoClassDefFoundError.

I believe I need to get the required hibernate (dom4j.jar, cglib.jar, commons-collections.jar, commons-logging.jar, ehcache.jar, log4j.jar) jar files into the WEB-INF/lib directory for them to be included in my project context classpath.

Using eclipse, I thought the hibernate jar files would be included in the context classpath.

Is this assumtion correct, and if so, how can I add the required jars and/or libraries into WEB-INF/lib directory using eclipse?

Thanks for any help.
SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
If you need them to build, then also add them to your build path
Avatar of deltaecho
deltaecho

ASKER

I need them to build, so the best way to do that is to add them to the "preferences->java->build path->user libraries?
right click on the prject and select configure build path
and add the required jars
Right click on the project folder --> Build Path --> Configure Bulid Path... --> Add External JARS
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Yeah, there's the rub.  I have the hibernate core libraries and the advanced support libraries under the libraries tab to add to the build path.  The default output folder is WEB-INF/classes.  I change that to WEB-INF/lib and the message at the top is "Cannot nest...WEB-INF/lib".
>> The default output folder is WEB-INF/classes.  I change that to WEB-INF/lib

Let the default output folder remain as it is. Copy the additional JARs to the lib folder for running.
That at least moved me onto a new problem.  Thanks for your help.
Isn't that what I suggested doing originally?
Hmmm. Needs to be analyzed.
Notified Venabili to assess.
It's always better to get an explanation of what's going on along with the correct answer.  mayankeagle did a great job of explaining the process as opposed to objects who had one liners.  If you want to split the points, that's fine, but more complete answers are always more appreciated!
You can always make uneven split (20-30 for example)
Can you open this question back up so I can do that?
Excellent work mayankeagle!
thanks mate :)
No worries :)