问题描述
如错误539536中所述,此问题已在Java 11支持补丁的最新版本中得到修复。该问题是由从 ZipFile 到 java.nio 类的迁移引起的,目前已恢复更改,但在撰写本文时仍在讨论中。
要安装此修补程序,请在Eclipse中使用以下更新站点,然后选择 v20181001-0921 或更新的版本:http ://download.eclipse.org/eclipse/updates/4.9-P-builds/P20181001-0525/
解决方法
我正在Windows 10上运行Eclipse 2018-09(4.9.0),正在使用Open JDK 11 GA。我有一个使用Java
8兼容源代码的项目,该项目可以使用Eclipse和Maven的JDK很好地进行编译。
我想使用Java 11的新功能,因此首先我将编译器源/目标从Java
8更改为Java11。它仍然在命令行上使用Maven构建了find,但是无法在Eclipse中进行编译(请参见Eclipse
2018-09不能编译Java 11源代码;认为它低于1.7)。
因此,我从Eclipse Marketplace中添加了“ Java 11 Support for Eclipse
2018-09”插件。我重新启动了Eclipse,并用来Alt+F5
刷新我的Maven项目。Eclipse然后尝试重建项目。
现在,Eclipse进入了一个无休止的循环,在8X%的完成率到9X%的完成率之间跳跃,并出现了反复的无尽错误,例如:
!SESSION 2018-09-27 08:08:51.188 -----------------------------------------------
eclipse.buildId=4.9.0.I20180906-0745
java.version=11
java.vendor=Oracle Corporation
BootLoader constants: OS=win32,ARCH=x86_64,WS=win32,NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
This is a continuation of log file …\.metadata\.bak_0.log
Created Time: 2018-09-27 08:11:22.981
!ENTRY org.eclipse.core.resources 4 2 2018-09-27 08:11:22.981
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.nio.file.ClosedFileSystemException
at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.ensureOpen(ZipFileSystem.java:1105)
at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.checkAccess(ZipFileSystem.java:332)
at jdk.zipfs/jdk.nio.zipfs.ZipPath.checkAccess(ZipPath.java:830)
at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.checkAccess(ZipFileSystemProvider.java:185)
at java.base/java.nio.file.Files.exists(Files.java:2439)
at org.eclipse.jdt.internal.core.builder.ClasspathMultiReleaseJar.findClass(ClasspathMultiReleaseJar.java:206)
at org.eclipse.jdt.internal.core.builder.ClasspathLocation.findClass(ClasspathLocation.java:58)
at org.eclipse.jdt.internal.core.builder.NameEnvironment.findClass(NameEnvironment.java:524)
at org.eclipse.jdt.internal.core.builder.NameEnvironment.findType(NameEnvironment.java:556)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.fromSplitPackageOrOracle(LookupEnvironment.java:414)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.lambda$1(LookupEnvironment.java:289)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForTypeFromModules(LookupEnvironment.java:384)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:288)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:262)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:530)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.checkAndSetImports(CompilationUnitScope.java:254)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:501)
at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:868)
at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:394)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:386)
at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:214)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:318)
at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:79)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:185)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:798)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:219)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:262)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:315)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:318)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:370)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:391)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:145)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
无法阻止它。至少Eclipse不会冻结,因此我点击了应用程序标题栏上的“关闭”按钮,并设法退出了程序。我可以重新进入程序,但是当我尝试构建它时,它会进入相同的无穷循环。