Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Adding jar file to lib using eclipse

Posted on 2006-03-21
20
Medium Priority
?
660 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:deltaecho
  • 6
  • 5
  • 5
  • +2
18 Comments
 
LVL 92

Assisted Solution

by:objects
objects earned 60 total points
ID: 16251567
just copy them into that directory in your project
0
 
LVL 92

Expert Comment

by:objects
ID: 16251576
If you need them to build, then also add them to your build path
0
 

Author Comment

by:deltaecho
ID: 16251828
I need them to build, so the best way to do that is to add them to the "preferences->java->build path->user libraries?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 92

Expert Comment

by:objects
ID: 16251889
right click on the prject and select configure build path
and add the required jars
0
 

Expert Comment

by:NoOodi
ID: 16252941
Right click on the project folder --> Build Path --> Configure Bulid Path... --> Add External JARS
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 90 total points
ID: 16254519
Eclipse class-path and the system class-path is different. While building, you need to add them as shown above because you want to build them through Eclipse. While running the application, if you don't use Eclipse, then you will need them in your server's class-path (either in WEB-INF\lib or the common\lib folder of the server).
0
 

Author Comment

by:deltaecho
ID: 16257673
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".
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16257730
>> 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.
0
 

Author Comment

by:deltaecho
ID: 16259432
That at least moved me onto a new problem.  Thanks for your help.
0
 
LVL 92

Expert Comment

by:objects
ID: 16263147
Isn't that what I suggested doing originally?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16265884
Hmmm. Needs to be analyzed.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16266211
Notified Venabili to assess.
0
 

Author Comment

by:deltaecho
ID: 16269353
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!
0
 
LVL 20

Expert Comment

by:Venabili
ID: 16270322
You can always make uneven split (20-30 for example)
0
 

Author Comment

by:deltaecho
ID: 16271397
Can you open this question back up so I can do that?
0
 

Author Comment

by:deltaecho
ID: 16271612
Excellent work mayankeagle!
0
 
LVL 92

Expert Comment

by:objects
ID: 16275163
thanks mate :)
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16277330
No worries :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question