简体   繁体   English

导入edu无法在Eclipse上解决

[英]The import edu cannot be resolved on Eclipse

I'm totally a freshman in Java and programming, and I'm studying algorithms on coursera. 我完全是Java和编程领域的新生,并且正在Coursera学习算法。 I want to practice by writing a simple BinarySearch and following the instructions on a book, but when I try to use the algs4.jar library provided by the book online sources, the library cannot be resolved: 我想通过写一个简单的BinarySearch并按照书上的说明进行练习,但是当我尝试使用该书在线资源提供的algs4.jar库时,该库无法解析:

在此处输入图片说明

It goes wrong when I try to import edu.princeton.cs.algs4.StdIn and Eclipse tells me the import edu cannot be resolved. 当我尝试导入edu.princeton.cs.algs4.StdIn时出现错误,并且Eclipse告诉我无法解析导入edu I have already put the jar file as referenced libraries by following the instructions (add algs4.jar to the classpath variable to the build path of a project via Project > Properties: Java Build Path > Libraries > Add External JARs ) 我已经按照说明将jar文件作为参考库放置了(通过Project> Properties:Java Build Path> Libraries> Add External JARalgs4.jar添加到classpath变量到项目的构建路径中)

You have a module-info.java which means you are using the Java Platform Module System (JPMS) which is optional but which when using it requires specifying used modules to be able to import things from them. 您有一个module-info.java ,这意味着您正在使用Java平台模块系统(JPMS) ,该系统是可选的,但在使用它时, 需要指定已使用的模块才能从其中导入内容。

Do one of the following: 请执行以下任一操作:

  • Delete src/module-info.java to not use JPMS 删除src/module-info.java以不使用JPMS
  • Go to the line with the error, hit Ctrl + 1 and choose the quick fix that adds the missing requires statement: Add 'requires ...' to module-info.java 去与错误的行,按Ctrl + 1并选择速战速决将失去的requires声明: 添加“要求......”到module-info.java

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

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