- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
在 Windows 10 上,我下载并安装了 Eclipse Oxygen [版本 (4.7.1a)构建 ID:20171005-1200] 使用 Eclipse Installer .
然后我使用“新建项目”向导创建了一个简单的 Java 项目(没有模块内容):
public class Demo1 {
public static void main(String[] args) {
new Demo1().test(0L);
}
void test(int i) {
doStuff();
}
void test(long l) {
doStuff();
}
void doStuff() {
String s = "abcde";
s = s.substring(2,4);
System.out.print("s=");
System.out.println( s.toString());
}
}
它运行正常,如果我为 test() 或 doStuff() 或 CTL=>Open Implementation strong>System 或 String 或 toString() 或 substr() 一切都很好。
但是,对于 println() 和 print() 会显示一条错误消息:
!ENTRY org.eclipse.jdt.ui 4 0 2017-10-23 01:42:54.695 !MESSAGE An error occurred while searching for implementations of 'print'. See error log for details. !STACK 1 Java Model Exception: Java Model Status [ is not on its project's build path] at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:570) at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:247) at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:505) at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:241) at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:505) at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:241) at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:107) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:583) at org.eclipse.jdt.internal.core.BinaryType.getElementInfo(BinaryType.java:287) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:306) at org.eclipse.jdt.internal.core.BinaryType.isInterface(BinaryType.java:725) at org.eclipse.jdt.internal.ui.javaeditor.JavaElementImplementationHyperlink$1.run(JavaElementImplementationHyperlink.java:237) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119) !SUBENTRY 1 org.eclipse.jdt.core 4 1006 2017-10-23 01:42:54.695 !MESSAGE is not on its project's build path
这看起来像是 Eclipse 或其安装程序中的一个错误,但这个问题非常基本,但我没有看到任何关于它的报告。我有几个问题:
有没有其他人遇到这个问题,或者它是否有效?
有什么我可以/应该做的配置来解决这个问题吗?
知道为什么 Open Implementation 只对 print() 和 println() 给出错误吗?
最佳答案
正如 @ZhekaKozlov 所指出的,这似乎是当前实现中的一个错误。来自another thread @Stephan 为 future 版本的 New & Noteworthy for Photon M3 分享了一份正在进行的文档指出:-
Note: It is not mandatory to run Eclipse with Java Runtime 9 to get the Java 9 support. However, a Java runtime 9 is required to be on a project's build path to compile a modular project against the system modules.
将 Java Runtime 9 添加到项目的构建路径后,系统模块将列在包资源管理器中的系统库下:
我假设 --add-modules=ALL-SYSTEM
正在解决这个问题,而用户将其作为 -vmargs
arg 附加到 eclipse.ini
。
关于java - 是什么导致 Eclipse Oxygen 1a 抛出 newJavaModelException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46883147/
我是一名优秀的程序员,十分优秀!