Results 1 to 8 of 8
Thread: class not found
- 09-21-2010, 11:35 AM #1
Member
- Join Date
- Sep 2010
- Posts
- 4
- Rep Power
- 0
class not found
Hello, i'm newbie in java
trying to make application that connect to the mysql database, it works fine in my pc, but not in the server
this line appeared :
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
i don't install j2sdk on the server, just the jre, i've put the mysql-connector-java-3.0.17-ga-bin.jar on the lib of the jre,
I also copy the driver on the same folder as the java app,
set the environment path of the windows to C:\myserver
the folder where the java app and the connector
restart the server, but it still happens
why is this happening?
thx
- 09-21-2010, 12:04 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Is this a webapp?
- 09-22-2010, 05:40 AM #3
Member
- Join Date
- Sep 2010
- Posts
- 4
- Rep Power
- 0
- 09-22-2010, 08:40 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
It's just you mentioned a server.
Don't stick the driver jar in the jre lib, that's just plain wrong.
Is your app a jar file?
- 09-22-2010, 09:10 AM #5
Member
- Join Date
- Sep 2010
- Posts
- 4
- Rep Power
- 0
- 09-22-2010, 09:18 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Put it with the class file.
And run using the -cp option, listing any required jar files (and .).
You don't set system paths...that is very bad practice. What if you had multiple apps which used different versions of a particular dependency? You'd have problems.
So use -cp.
- 09-22-2010, 11:24 AM #7
Member
- Join Date
- Sep 2010
- Posts
- 4
- Rep Power
- 0
- 09-22-2010, 11:25 AM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
Class not found Exception
By surendra in forum Java ServletReplies: 8Last Post: 06-09-2011, 12:52 PM -
Class Not found
By jitendra in forum AWT / SwingReplies: 5Last Post: 02-26-2010, 10:55 AM -
main class not found
By abhijit in forum NetworkingReplies: 3Last Post: 10-01-2009, 09:05 AM -
No Class Def Found Error:
By fithous in forum Java AppletsReplies: 0Last Post: 04-02-2009, 05:30 PM -
No Class Def Found Error:
By wrap23 in forum New To JavaReplies: 9Last Post: 10-02-2008, 04:07 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks