aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes need help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "need help" Watch "need help" New topic
Author

need help

Cherry Gupta
Greenhorn

Joined: Feb 09, 2010
Posts: 17
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
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42282
    
  64
That library needs to be in whatever classpath is used at runtime. (The build path is used at compile time, not runtime.)


Ping & DNS - my free Android networking tools app
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Also, please place your code inside the CODE tags


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Cherry Gupta
Greenhorn

Joined: Feb 09, 2010
Posts: 17
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
Marshal

Joined: Mar 22, 2005
Posts: 42282
    
  64
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

Joined: Feb 09, 2010
Posts: 17
I have put the jar file like this

Do I need to place the jar file somewhere else also?


[Thumbnail for problem.JPG]

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42282
    
  64
As I said, if it's a web app, then it needs to be in WEB-INF/lib.
Cherry Gupta
Greenhorn

Joined: Feb 09, 2010
Posts: 17
still the same problem.

I had put the jar file in lib folder to but no luck.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Verify it's being deployed, however you're running the web app. Normally putting it in WEB-INF/lib would be enough.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 645
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?

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

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.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help