• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

need help

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

When I m trying to run my servlet from eclipse using JDBC coding I m getting ClassNotFoundException on line Class.forName("com.mysql.jdbc.Driver")

I have already placed mysql executable jar file into the build path of the project but still no luck.m I need to do anything else to make this class available?

Please help me to sort out the problem!

Thanks
Cherry
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That library needs to be in whatever classpath is used at runtime. (The build path is used at compile time, not runtime.)
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, please place your code inside the CODE tags
 
Cherry Gupta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have put the jar file in libraries folder from where all other jar files are executed at runtime but still saying ClassNotFoundException.

Please help me out.

Thanks
Cherry
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Putting a jar file into a directory does not generally make that jar file available as part of the classpath. It does that only in certain circumstances, like if the directory in question is the WEB-INF/lib directory of a web app. Is that the case here? If it is, have you restarted the server, or at least the web app?
 
Cherry Gupta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have put the jar file like this

Do I need to place the jar file somewhere else also?
problem.JPG
[Thumbnail for problem.JPG]
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said, if it's a web app, then it needs to be in WEB-INF/lib.
 
Cherry Gupta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
still the same problem.

I had put the jar file in lib folder to but no luck.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Verify it's being deployed, however you're running the web app. Normally putting it in WEB-INF/lib would be enough.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Cherry Gupta wrote:still the same problem.

I had put the jar file in lib folder to but no luck.



I think you need to double check everything. Are you sure you have the correct Jar? Open that Jar and make sure it contains the class your application is looking for.

Are you sure you've copied the Jar into the correct directory? You've said you copied it into a 'lib' directory, but not which lib directory.

Are you sure you re-build the application since making this change, then re-deployed it?

Are you creating War file for your application? Did you inspect the generated War file to make sure the Jar is actually in the correct location within the War file?

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cherry, please retitle you post with a better heading than "Need Help". It is assume that every post in this forum is from someone who needs help and if they all used your same heading, how would anyone be able to differentiate among posts? The title should be very specific as to the problem you are facing. Thank you.
 
I found a beautiful pie. And a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic