简体   繁体   English

Eclipse 编辑器无法打开

[英]Eclipse editor won't open

My Eclipse cannot show the editor window.我的 Eclipse 无法显示编辑器窗口。

Error:错误:

Could not open the editor: The editor class could not be instantiated.无法打开编辑器:无法实例化编辑器类。 This usually indicates a missing no-arg constructor or that the editor's class name was mistyped in plugin.xml.这通常表示缺少无参数构造函数或在 plugin.xml 中输入错误的编辑器类名。

Notes:笔记:

  • I'm using different Eclipse (and not plug-ins) for C++ and Python - and they work flawlessly, it's just the java eclipse that is causing troubles.我为 C++ 和 Python 使用了不同的 Eclipse(而不是插件)——它们工作完美,只是 java eclipse 造成了麻烦。
  • I've already tried re-installing eclipse, and even reinstalling java.我已经尝试过重新安装 eclipse,甚至重新安装 java。 any idea?任何的想法?
  • It has no troubles displaying the project file, it's "just" the *.java and *.class files that cannot be opened.显示项目文件没有问题,它“只是”无法打开的 *.java 和 *.class 文件。

Stack trace堆栈跟踪

org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.jdt.ui (150).
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:121)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:453)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:338)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:232)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1197)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:904)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:267)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:263)
    at org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:235)
    at org.eclipse.ui.internal.EditorManager.createPart(EditorManager.java:845)
    at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:609)
    at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
    at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(EditorAreaHelper.java:271)
    at org.eclipse.ui.internal.EditorManager.setVisibleEditor(EditorManager.java:1429)
    at org.eclipse.ui.internal.EditorManager$5.runWithException(EditorManager.java:942)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
    at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
    at org.eclipse.ui.internal.Workbench$31.runWithException(Workbench.java:1567)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2548)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    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:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
Caused by: org.osgi.framework.BundleException: The activator org.eclipse.jdt.internal.ui.JavaPlugin for bundle org.eclipse.jdt.ui is invalid
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:156)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
    at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:265)
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:106)
    ... 57 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jdt/core/IBufferFactory
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:151)
    ... 63 more
Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.jdt.core (140).
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:121)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:453)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
    at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:466)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 69 more
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.jdt.core.JavaCore.start() of bundle org.eclipse.jdt.core.
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
    at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:265)
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:106)
    ... 78 more
Caused by: java.lang.NullPointerException
    at org.eclipse.core.runtime.Path.<init>(Path.java:183)
    at org.eclipse.core.internal.resources.WorkspaceRoot.getProject(WorkspaceRoot.java:181)
    at org.eclipse.jdt.internal.core.ExternalFoldersManager.isExternalFolderPath(ExternalFoldersManager.java:90)
    at org.eclipse.jdt.internal.core.JavaProject.addToResult(JavaProject.java:2738)
    at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2688)
    at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2783)
    at org.eclipse.jdt.internal.core.DeltaProcessingState.getRootInfos(DeltaProcessingState.java:301)
    at org.eclipse.jdt.internal.core.DeltaProcessingState.initializeRootsWithPreviousSession(DeltaProcessingState.java:271)
    at org.eclipse.jdt.internal.core.JavaModelManager.startup(JavaModelManager.java:4712)
    at org.eclipse.jdt.core.JavaCore.start(JavaCore.java:5048)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
    ... 84 more

EDIT:编辑:

eclipse version: 3.6.2日食版本:3.6.2
eclipse.ini file: eclipse.ini 文件:

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx384m

EDIT 2:编辑2:
I changed the workspace and it fixed the problem (for the new workspace at least) but still - no idea why it happened.我更改了工作区并解决了问题(至少对于新工作区而言),但仍然 - 不知道为什么会发生。 (though I am still curious, so I leave this question open). (虽然我仍然很好奇,所以我把这个问题留了下来)。

This is often a problem with temporary files saved by eclipse plugins.这通常是 eclipse 插件保存的临时文件的问题。 Check YOUR_WORKSPACE/.metadata/.plugins/org.eclipse.jdt.core/ .检查YOUR_WORKSPACE/.metadata/.plugins/org.eclipse.jdt.core/ There are a lot of index files.有很多索引文件。 Sometimes it helps to delete them.有时删除它们会有所帮助。 Also, start your eclipse with -clean .另外,用-clean开始你的日食。

But I think your problem is slightly different.但我认为你的问题略有不同。 Did you have a reference to a library(jar-file) somewhere in your filesystem?您是否在文件系统中的某处引用了库(jar 文件)? If you deleted it or moved it, eclipse can't build your projects.如果您删除或移动它,eclipse 将无法构建您的项目。

Did you refresh all your projects?你刷新了所有的项目吗?

I've got the same problem though my eclipse is much newer - 4.2 (Juno).尽管我的 eclipse 更新了很多 - 4.2 (Juno),但我也遇到了同样的问题。 For me the solution was to remove <workspace>/.metadata/.plugins/org.eclipse.core.resources/.snap .对我来说,解决方案是删除<workspace>/.metadata/.plugins/org.eclipse.core.resources/.snap Afterwards I found this bug in eclipse.org: Bug 178988 - Crash at startup due to ".snap" files .后来我在 eclipse.org 中发现了这个错误:错误 178988 - 由于“.snap”文件在启动时崩溃

Hope this will help somebody.希望这会帮助某人。

at org.eclipse.core.runtime.Path.<init>(Path.java:183)
at org.eclipse.core.internal.resources.WorkspaceRoot.getProject(WorkspaceRoot.java:181)
at org.eclipse.jdt.internal.core.ExternalFoldersManager.isExternalFolderPath(ExternalFoldersManager.java:90)
at org.eclipse.jdt.internal.core.JavaProject.addToResult(JavaProject.java:2738)
at org.eclipse.jdt.internal.core.JavaProject.resolveClasspath(JavaProject.java:2688)

The stack trace seem to indicate that there is a problem with your classpath.堆栈跟踪似乎表明您的类路径存在问题。

  1. Maybe your JRE is pointing to an invalid location / isn't defined?也许您的 JRE 指向无效位置/未定义? (Window->Preferences->Java->Installed JREs). (Window->Preferences->Java->Installed JREs)。
  2. Maybe your project contains invalid class path entries?也许您的项目包含无效的类路径条目? Try to create a new java project and check if that is working as expected.尝试创建一个新的 Java 项目并检查它是否按预期工作。 If it works check the classpath of your not working project.如果它有效,请检查您不工作的项目的类路径。

Edit: Another Idea ... launch eclipse on an other workspace.编辑:另一个想法......在另一个工作区上启动eclipse。 Then create a launch configuration for an "Eclipse Configuration" with the workspace that produces an error.然后使用产生错误的工作区为“Eclipse 配置”创建启动配置。 Set a java exception breakpoint for NullPointerException.为 NullPointerException 设置一个 java 异常断点。 Start in debug mode and you can inspect the variables to see which path produces the problems.在调试模式下启动,您可以检查变量以查看哪个路径产生问题。

Google this error and you get plenty of hits in a variety of (Eclipse) IDE's and plugins.谷歌这个错误,你会在各种(Eclipse)IDE 和插件中获得大量点击。 There seems to be no record of real 'fix' though, besides the one you found out where you create a new workspace.但是,除了您发现创建新工作区的位置之外,似乎没有真正“修复”的记录。

3.6.2.r362_v20110210 is the version I'm running. 3.6.2.r362_v20110210 是我正在运行的版本。 Are you sure you're on 3.6.2? 你确定你在 3.6.2 上吗? You're first edit lists 您是第一个编辑列表

-startup plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2. -启动插件/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2。 R36x_v20101222 R36x_v20101222

which seems to point at an older release. 这似乎指向较旧的版本。

I agree with another poster that you should definitely search and/or post this on Eclipse's bugtracking system.我同意另一张海报,你绝对应该在 Eclipse 的错误跟踪系统上搜索和/或张贴这个。 That's the least you can do when you use open source software.当您使用开源软件时,这是您至少可以做到的。

I tried a couple of options我尝试了几个选项

  1. delete cache files within .plugins删除 .plugins 中的缓存文件
  2. delete all index files in <workspace>/.metadata/.plugins/org.eclipse.jdt.core删除<workspace>/.metadata/.plugins/org.eclipse.jdt.core所有索引文件
  3. delete snap file in <workspace>/.metadata/.plugins/org.eclipse.core.resources/.snap删除<workspace>/.metadata/.plugins/org.eclipse.core.resources/.snap snap 文件
  4. -clean as a start up parameter -clean作为启动参数
  5. -initialize as a start up parameter -initialize为启动参数

But I keep getting the error back randomly.但是我不断地随机返回错误。

So far, the only option that worked consistently is removing the .snap file, the first time we launch eclipse after removing .snap file it works fine.到目前为止,唯一一致工作的选项是删除 .snap 文件,我们在删除 .snap 文件后第一次启动 eclipse 时它工作正常。

Also any time we launch it in a new workspace;也可以在任何时候我们在新工作区中启动它; it works fine.它工作正常。 but we would hate to switch the workspace for this reason.但我们不想因为这个原因切换工作区。

Moreover if we close and relaunch eclipse the issue comes back randomly.此外,如果我们关闭并重新启动 eclipse,问题会随机返回。

I was getting this for FlashBuilder 4.7.我为 FlashBuilder 4.7 得到了这个。 It was a permissions issue.这是一个权限问题。 On Mac OSX, from the info box, I gave my user READ & WRITE access to Flash Builder 4.7 folder, then did "Apply to enclosed items..." and that fixed it.在 Mac OSX 上,从信息框中,我为我的用户提供了对 Flash Builder 4.7 文件夹的 READ & WRITE 访问权限,然后执行了“应用于封闭项目...”并修复了它。

The solution to the above problem is to go to workspace.metadata.plugins\\org.eclipse.jdt.core & remove all the index files.解决上述问题的方法是转到workspace.metadata.plugins\\org.eclipse.jdt.core并删除所有索引文件。

Thanks FlorianOver感谢 FlorianOver

有同样的问题(在 Indigo 3.7 上)并获得正确版本的 jadclipse jar(net.sf.jadclipse_3.3.0.jar with Jad 1.5.8g)为我做了

Removing the index files as suggested by others didn't help in my case.按照其他人的建议删除索引文件对我来说没有帮助。 I had to reset the perspective: right-click the "Java" perspective toggle button in the upper right corner, choose "Reset".我不得不重置视角:右键单击右上角的“Java”视角切换按钮,选择“重置”。 At least it's better than recreating the entire workspace.至少比重新创建整个工作区要好。

对我来说,它可以删除 workspace/.metadate/.lock 然后使用 eclispe -clean -refresh 重新启动

Here was simple.这很简单。 Right-click in the class and choose the / open with / Java Editor, or Generic Text Editor option.在类中右键单击并选择 / open with / Java Editor 或 Generic Text Editor 选项。

Aqui foi simples. Aqui foi 简单。 Clique na classe com o botão direito e escolha a opção / open com / Editor Java, ou Editor de Texto Genérico. Clique na classe com o botão direito e escolha a opção / open com / Editor Java, ou Editor de Texto Genérico。

When I faced this issue.当我遇到这个问题时。 I simple updated the eclipse and it resolve the problem.我简单地更新了 eclipse 并解决了问题。

A solution which worked for me (after first unsuccessfully trying the other more accurate steps listed above) was to do as below:一个对我有用的解决方案(在第一次尝试上面列出的其他更准确的步骤失败之后)是这样做的:

  1. Close Eclipse and delete all the contents of {Workspace}.metadata.plugins folder.关闭 Eclipse 并删除 {Workspace}.metadata.plugins 文件夹中的所有内容。
  2. Open Eclipse.打开日食。 It does not show any projects.它不显示任何项目。
  3. Import the projects into the workspace by going to the File menu, clicking import and continuing with steps.通过转到“文件”菜单,单击“导入”并继续执行步骤,将项目导入工作区。

The issue gets resolved this way.问题就这样解决了。 However, a drawback is that you have to import the projects again after the steps.但是,一个缺点是您必须在这些步骤之后再次导入项目。

I faced the same issue.我遇到了同样的问题。 It was basically caused by a version mismatch of the jadclipse jar.它基本上是由jadclipse jar 的版本不匹配引起的。 Initially I had jadclipse_3.2.1.jar but then I updated to net.sf.jadclipse_3.3.0.jar .最初我有jadclipse_3.2.1.jar但后来我更新到net.sf.jadclipse_3.3.0.jar Resolved the issue.解决了问题。

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

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