eclipse插件编程中的“Workbench尚未创建”错误

随着我的eclipse插件启动,我得到Root exception:java.lang.IllegalStateException: Workbench has not been created yet. 错误。

并且它似乎导致副作用使一些包exception错误。 我不认为我的代码使用egit模块。

 org.osgi.framework.BundleException: Exception in org.eclipse.egit.ui.Activator.start() of bundle org.eclipse.egit.ui. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381) at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300) 

如何删除此错误? 这是访问工作区的代码。 我发现这篇文章 – 调试失败的Eclipse启动说它是竞争条件,但我不确定为什么我有竞争条件,如果是这样,如何删除它。

 public void renameClassRefactor() throws CoreException { // get the project information with ResourcesPlugin IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); // 1. The name of the project in the workspace System.out.println(ResourcesPlugin.getWorkspace().toString()); java.io.File workspaceDirectory = root.getLocation().toFile(); System.out.println(workspaceDirectory.toString()); 

我为“完成工作台尚未创建”而苦苦挣扎。

但我通过以下步骤得到了解决方案.-

  1. 转到运行配置 – >删除所有目标平台jar。
  2. 单击“添加必需的包”。
  3. 检查org.apache.felix.gogo.runtimeorg.apache.felix.gogo.shellorg.eclipse.equinox.consoleorg.eclipse.osgi和您的jar文件。
  4. 最后也是重要的一步。 转到设置 – > 选中启动前清除配置区域 ”复选框。
  5. 立即运行OSGi应用程序。
  6. 享受它是否适合你,因为它对我有用。

谢谢

参考此站点 ,我可以在运行配置中添加-clean参数以删除错误消息。

在此处输入图像描述