随着我的 eclipse 插件启动,我得到了Root exception:java.lang.IllegalStateException: Workbench has not been created yet.
error.
而且它似乎会导致产生一些捆绑异常错误的副作用。我认为我的代码没有使用 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 启动 http://www.eclipsezone.com/eclipse/forums/t99010.html说这是竞争条件,但我不确定为什么我有竞争条件,如果是的话,如何删除它。
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());
我一整天都在为“工作台尚未创建”而苦苦挣扎。
但我通过以下步骤得到了解决方案。-
- 前往运行配置-> 删除所有目标平台 jar。
- 单击添加所需的捆绑包。
- 检查
org.apache.felix.gogo.runtime
, org.apache.felix.gogo.shell
, org.eclipse.equinox.console
, org.eclipse.osgi
和你的 jar 文件。
- 最后也是重要的一步。去Setting-> check的复选框“启动前清除配置区域".
- 现在运行 OSGi 应用程序。
- 如果它对你有用,就像它对我有用一样,请尽情享受。
Thanks
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)