【发布时间】:2014-09-13 09:55:27
【问题描述】:
我正在开发一个关于 Eclipse 的 java 项目。当我按Run As Eclipse Application 时,它曾经工作过。现在它突然停止工作了:
自上次工作以来我唯一做的就是卸载和安装不同的 java 和 jdk 版本。目前我在C:\Program Files\Java 中有这 3 个:
- jre7
- jre1.8.0_20
- jdk1.8.0_20
我不知道第二个是什么。我在"Programs and Features" 找不到。
在path 变量中我有:
C:\Program Files\Java\jre7\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\libnvvp;C:\Python27\Lib\site-packages\PyQt4;C:\Python27;C:\Python27\Scripts;C:\OpenSSH\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Downloads\Android\adt-bundle-windows-x86_64-20140702\sdk\tools
这是我在错误消息上点击"Yes, in an editor" 时的一些日志:
!SESSION 2014-08-25 17:21:53.071 -----------------------------------------------
eclipse.buildId=M20090917-0800
java.version=1.7.0_67
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.sdk.ide
Command-line arguments: -product org.eclipse.sdk.ide -data C:\Dropbox\University\Semester 5\Project\workspace/../runtime-EclipseApplication -dev file:C:/Dropbox/University/Semester 5/Project/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86_64
This is a continuation of log file C:\Dropbox\University\Semester 5\Project\runtime-EclipseApplication\.metadata\.bak_0.log
Created Time: 2014-08-25 17:21:56.118
!ENTRY org.eclipse.osgi 4 0 2014-08-25 17:21:56.118
!MESSAGE Application error
!STACK 1
java.lang.NoClassDefFoundError: org/eclipse/core/resources/IContainer
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:114)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
...
Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.core.resources (3814).
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:125)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:381)
at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:454)
...
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.core.resources.ResourcesPlugin.start() of bundle org.eclipse.core.resources.
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
...
Caused by: java.lang.StackOverflowError
at java.util.HashMap.init(Unknown Source)
at java.util.HashMap.<init>(Unknown Source)
at java.util.HashMap.<init>(Unknown Source)
at java.util.HashSet.<init>(Unknown Source)
at org.eclipse.core.internal.resources.MarkerTypeDefinitionCache.computeSuperTypes(MarkerTypeDefinitionCache.java:88)
at org.eclipse.core.internal.resources.MarkerTypeDefinitionCache.computeSuperTypes(MarkerTypeDefinitionCache.java:94)
...
!ENTRY org.eclipse.jdt.core 2 0 2014-08-28 10:19:14.693
!MESSAGE The Java indexing could not index C:/Program Files/Java/jre7/lib/ext/nashorn.jar|jdk/nashorn/internal/objects/NativeArray$Constructor.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
...
为什么会这样?
我应该发布更多信息以便识别问题吗?
编辑:
我在项目中发现如下警告:
The JRE container on the classpath is not a perfect match to the 'JavaSE-1.6' execution environment MANIFEST.MF /JDTCommentsV2/META-INF line 11 Plug-in Problem
对应MANIFEST.MF中的这一行:
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
编辑:
我通过以下方式解决了这个问题:右键单击 -> 快速修复
但现在我又遇到了另一个错误:
Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment.
解决方案here和here建议在项目->属性->添加库->JRE系统库中选择Workspace default JRE。这带回了:
The JRE container on the classpath is not a perfect match to the 'JavaSE-1.6' execution environment MANIFEST.MF /JDTCommentsV2/META-INF line 11 Plug-in Problem
编辑:
我更改了workspace 的位置(将其放在桌面上),现在它可以工作了。但我需要原始路径(因为它是保管箱中的共享文件夹......)。有什么想法吗?
【问题讨论】:
-
不确定这是否适用,但是:如果您转到 Windows -> 首选项 -> Java -> 已安装的 JRE。它是否显示您正在使用的 JRE?您可以尝试从您指定的位置添加新的 JRE。您可以通过以下方式执行此操作:添加... -> 标准 VM -> JRE 主页的 JDK 路径 -> 完成。之后,从 Installed JRE's 部分中选择 JRE。
-
是的,我有两件事:jdk1.8.2_20 和 jre7。选择
jre7给出了所描述的问题,选择jdk1.8.2_20给出了错误:The project was not built since its build path incomplete...和 -
嗯,如果你把它设置回JRE7(我猜那是最新版本,所以它应该兼容)。另外,你有没有安装JDK?
-
是的,我安装了最新的 jdk:oracle.com/technetwork/java/javase/downloads/…