问题
I tried to install and use the Java 9 support for Eclipse Mars. However when trying to compile a simple Hello World program I get two errors in Eclipse:
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files Main.java /Java9Test/src line 1 Java Problem
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project Java9Test Unknown Java Problem
(although I cannot see any errors when looking at the build path)
Is anyone facing similiar problems? How can this be fixed?
Here is what I've done so far ...
- Installing OpenJDK 9 went fine (javac and java are working properly).
- Eclipse update went fine (I did it using the Marketplace and using the provided link).
- When starting eclipse using Java 9, I got two errors (one regarding the Java version, and one regarding a garbage collector option) but managed to "fix" them by removing these options from eclipse.ini.
- Configured the OpenJDK 9 in Eclipse, changed the source level to 9 and rebuilt the project/restarted Eclipse a couple of times.
回答1:
Update:16 October,2017
The message is clear from the Eclipse maintainers ::
Mars is a past version of Eclipse. Please visit our download page for the latest version of Eclipse.
You shall upgrade to using Eclipse Oxygen.1a (4.7.1a) Release released on October 11, 2017 to support JPMS.
回答2:
Eclipse Mars does not support Java 9. It'll throw IllegalStateException. It'll support till Java 8.
来源:https://stackoverflow.com/questions/31976929/eclipse-mars-support-for-java9-build-path-settings