奋斗 - 类未找到异常:com.mysql.jdbc.Driver在JAVA中 [英] Struggling with - Class not found exception: com.mysql.jdbc.Driver in JAVA

查看:238
本文介绍了奋斗 - 类未找到异常:com.mysql.jdbc.Driver在JAVA中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Netbeans ide 7.0中,我面临这个特殊的问题。我在我的程序中写了以下代码行。

In Netbeans ide 7.0, I am facing this particular problem. I wrote the following line of code in my program

Class.forName(com.mysql.jdbc.Driver)。newInstance();

Class.forName("com.mysql.jdbc.Driver").newInstance();

这一行正在抛出异常。当我从netbeans 7.0中的服务 - >数据库 - >驱动程序 - > MySQL(Connector / Jdriver)连接同一个mysql数据库服务器时,它已经连接。当我进入该连接的属性,我发现它是连接mysql服务器使用相同的类,我在代码行。

This particular line is throwing an exception. And when I connected the same mysql db server from the "Services -> Databases -> Drivers -> MySQL(Connector/Jdriver)" in the netbeans 7.0, it got connected. When I went into the properties of that connection I found that it is connecting the mysql server using the same class which I used in the line of code.

我也读了一些的论坛,例如

I also read some of the forums such as

http://www.javakb.com/Uwe/Forum.aspx/java-setup/11895/ClassNotFoundException-com-mysql-jdbc-Driver-from -netbeans

但是这1是Ubuntu上的netbeans。 Windows

but this 1 is for netbeans on Ubuntu. What about Windows?

http://forums.mysql.com/read.php?60,42473,42473#msg -42473

我不知道是什么问题?请帮助。

I don't know what is wrong? Please help.

推荐答案

您需要从这里下载连接器: http://www.mysql.com/products/connector/ ,并将其包含在您的类路径中

You need to download the connector from here: http://www.mysql.com/products/connector/ and include it in your classpath

这篇关于奋斗 - 类未找到异常:com.mysql.jdbc.Driver在JAVA中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆