com.mysql cannot be resolved to a type 错误
在测试mysql的时候报错,我用的是mysql5.0.22,用的驱动包是5.0.8的,在测试的时候报错
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.DriverManager;
public class Test{
public static void main(String[] args){
}
static void test() throws Exception{
//注册驱动
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
}
}
在com.mysql下总是有红线,报错
com.mysql.cannot be resolved to a type
Multiple markers at this line
- com.mysql cannot be resolved to a type
- Occurrence of "mysql"
注:mysql-connector-java-5.0.8.zip 包已经导入