JDBC ClassNotFound甚至使用MySQL库

时间:2021-09-01 22:49:24

So I am trying to connect to my server, I had it working before but now I moved to a different machine it's not working as you can see below.

所以我正在尝试连接到我的服务器,我之前有它工作,但现在我搬到了另一台机器,它不能正常工作,如下所示。

JDBC ClassNotFound甚至使用MySQL库

I have added the MySQL driver into my path and I'm not sure what the problem could be.

我已将MySQL驱动程序添加到我的路径中,我不确定问题是什么。

Any ideas?

Thanks.

2 个解决方案

#1


2  

You indeed have defined that MySQL connector is a library for your project, but you also need to add it as a module dependency on the Modules tab in Project Structure.

您确实已经定义MySQL连接器是项目的库,但您还需要将它作为模块依赖项添加到项目结构中的模块选项卡上。

#2


0  

If you haven't dependency management such as maven (gradle, etc), create lib folder in project root folder. Move jar to lib folder and right click on it and select "Add as library". This should help you.

如果您没有依赖管理,如maven(gradle等),请在项目根文件夹中创建lib文件夹。将jar移动到lib文件夹并右键单击它并选择“Add as library”。这应该对你有帮助。

#1


2  

You indeed have defined that MySQL connector is a library for your project, but you also need to add it as a module dependency on the Modules tab in Project Structure.

您确实已经定义MySQL连接器是项目的库,但您还需要将它作为模块依赖项添加到项目结构中的模块选项卡上。

#2


0  

If you haven't dependency management such as maven (gradle, etc), create lib folder in project root folder. Move jar to lib folder and right click on it and select "Add as library". This should help you.

如果您没有依赖管理,如maven(gradle等),请在项目根文件夹中创建lib文件夹。将jar移动到lib文件夹并右键单击它并选择“Add as library”。这应该对你有帮助。