java 驱动为何加了cj还是出现报错

为何加了cj还是出现报错Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class iscom.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException图片说明

Class.forName("com.mysql.jdbc.Driver"); 为什么加一个cj。

检查是否存在老的jar包,包括你的项目lib和 tomcat的lib目录下