简体   繁体   English

'无法解析导入 java.sql' eclipse

[英]'the import java.sql cannot be resolved' eclipse

I am getting this error while trying to work with MySql and Java.我在尝试使用 MySql 和 Java 时遇到此错误。 I have downloaded the right.jar file and I added it to the Project->Properties->java Build Path->both ModulePath and ClassPath just in case.我已经下载了 right.jar 文件,并将其添加到 Project->Properties->java Build Path->ModulePath 和 ClassPath 以防万一。 I am still getting the error.我仍然收到错误消息。 I found out that I need to write "requires java.sql" inside the module, and it does solve my problem, but then when I run it say "Class Module could not be found".我发现我需要在模块内写“需要 java.sql”,它确实解决了我的问题,但是当我运行它时说“找不到类模块”。 Without this line (just the empty module) works fine, but I still have that initial error.没有这条线(只是空模块)工作正常,但我仍然有那个初始错误。 What should I do?我应该怎么办?

You have to include a string "requires java.sql;"您必须包含一个字符串“需要 java.sql;” into the module-info.java.进入模块信息.java。

module-info.java is a module that provides a module descriptor—metadata that specifies the module's dependencies, the packages the module makes available to other modules, and more. module-info.java 是一个提供模块描述符的模块——元数据指定模块的依赖关系、模块提供给其他模块的包等等。

requires:- A requires module directive specifies that this module depends on another module which means it specifies module dependency . requires:- requires 模块指令指定此模块依赖于另一个模块,这意味着它指定了模块依赖项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM