Java:Netbeans - 没有找到适合 jdbc mysql 的驱动程序(在构建和清理项目之后)
在 Netbeans 中,我在项目中选择了“构建和清理”选项,但是如果我从 /dist 文件夹中移动 .jar 文件,则会收到此错误:
“错误:找不到适合‘我的数据库网址’的驱动程序”
现在我知道数据库连接可以正常工作,因为当我在 netbeans 中运行该项目时,如果我离开,我可以检索数据并将其输入到数据库中/dist 文件夹中的 .jar 文件可以正常工作。无论如何,我可以在构建项目时包含驱动程序吗?
如果这没有意义,请随时告诉我,我会尽力详细说明。
非常感谢任何帮助。
In Netbeans I've selected the 'build and clean' option on my project, however if I move the .jar file from the /dist folder, I get this error:
"Error: not suitable driver found for 'my database url here'"
Now I know that the database connection works because when I run the project in netbeans I'm able to retrieve and input data into the database, if I leave the .jar file in the /dist folder it works with no problems. Is there anyway I can include drivers when building the project?
Feel free to tell me if this makes no sense and I'll try my best to elaborate.
Any help is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新
这里的问题是您的 netbeans 不包含构建中所需的驱动,而是从 dist 中的 lib 目录引用它
来终止此
goto netbeans 项目 > build.xml
在
之前的
添加此注意:quartz-1.5.2.jar 将由您的项目 file.reference.quartz-1.5.2 引用。罐
您可以从您的
project.properties
文件中获取此类指针,尝试找到 jdbc jar 的指针和所有必需的内容,然后添加,这样它就可以工作了。从任何地方清理、构建和运行它。它将包含外部库到构建中
Update
The problem here is your netbeans doesn't include required drived in build instead it is referring it from lib dir in dist
to kill this
goto netbeans project > build.xml
before
</project>
add thisNote: quartz-1.5.2.jar will be referred by your project file.reference.quartz-1.5.2.jar
You can get such pointers from your
project.properties
file try to find jdbc jar's pointer and all required and add then this way it will work.clean and build and run it from anywhere. it will include external libraries into build