Tycho 開發Eclipe 插件打包運行報錯Ensure that the org.eclipse.core.runtime bundle is resolved and started
開發環境
軟件 | 版本 |
---|---|
Eclipse版本 | Mars Release (4.5.0) |
JDK | 1.8.0_144 |
Maven | 3.3.3 |
異常現象
用tycho開發Eclipse插件項目,參考了vogella上的一篇文章(鏈接地址)做demo的時候,發現直接在eclipse idea中運行沒有問題,但是項目打包成可執行程序後運行報錯,錯誤如下:
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:78)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
在github中對比了其它tycho demo程序,懷疑可能是.product文件>Configuration>Start Levels設置有問題。
vogella文章中的Start Levels設置如下:
<configurations>
<plugin id="org.eclipse.core.runtime" autoStart="false" startLevel="2" />
<plugin id="org.eclipse.equinox.ds" autoStart="false" startLevel="3" />
<plugin id="org.eclipse.equinox.event" autoStart="false" startLevel="3" />
</configurations>
解決辦法
將Start Levels按如下配置之後問題得到了解決
<configurations>
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
<plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="3" />
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="3" />
</configurations>
待解決
vogella文章中的應該是作者測試過的,爲什麼他運行沒問題?難道因爲我們的運行環境不一樣?