问题
I have Eclipse LUNA and JDK 8 installed on my computer. I get the message "The import java.sql cannot be resolved" on the import lines.
i checked the jre definition (windows -> reference -> java -> installed JREs and it is setup there to the folder of the jre on my computer.
what is the problem?
回答1:
Right click on project - >BuildPath - >Configure BuildPath - >Libraries tab - >
Double click on JRE SYSTEM LIBRARY - >Then select alternate JRE
Try this.. After that once clean your project too..
回答2:
You can also try declaring a dependency
requires java.sql;
on your module-descriptor file(module-info.java).
回答3:
It is my experience that workspaces do not always work correctly after upgrading Eclipse to a newer version.
Recreate your workspace from your version control system.
来源:https://stackoverflow.com/questions/24712858/eclipe-luna-the-import-java-sql-cannot-be-resolved