【问题标题】:config.ini setup for headless eclipse无头日食的 config.ini 设置
【发布时间】:2012-10-01 11:54:11
【问题描述】:

来自this post,当我尝试执行无头 Eclipse 代码时收到此错误消息。

java.lang.RuntimeException: Could not find framework
    at org.eclipse.equinox.launcher.Main.getBootPath(Main.java:978)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:557)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

我用谷歌搜索找到这个作为问题的答案: "Unable to acquire application service" error while launching Eclipse

但是,我不确定如何放置 config.ini 以及如何放置正确的内容以删除错误消息。

这是我的目录结构,我在 eclipse.ini 文件中有Dosgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.update.configurator@3:start,org.eclipse.core.runtime@

如何设置 eclipse.ini 文件,以及该文件的位置?

jar文件在plugins目录下,runme.sh有这个脚本:

R2_HOME=.
LIBS=plugins
JARS=.:\
$LIBS/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar:\
$LIBS/org.eclipse.core.jobs_3.5.100.v20110404.jar:\
$LIBS/org.eclipse.core.runtime_3.7.0.v20110110.jar:\
$LIBS/org.eclipse.core.runtime.compatibility.auth_3.2.200.v20110110.jar:\
$LIBS/org.eclipse.equinox.common_3.6.0.v20110523.jar:\
$LIBS/org.eclipse.equinox.app_1.3.100.v20110321.jar:\
$LIBS/org.eclipse.equinox.launcher_1.2.0.v20110502.jar:\
$LIBS/org.eclipse.equinox.preferences_3.4.1.R37x_v20110725.jar:\
$LIBS/org.eclipse.core.variables_3.2.500.v20110928-1503.jar:\
$LIBS/org.eclipse.osgi.services_3.3.0.v20110513.jar:\
$LIBS/org.eclipse.osgi.util_3.2.200.v20110110:\
$LIBS/org.eclipse.osgi_3.7.2.v20120110-1415

java -cp $JARS org.eclipse.core.launcher.Main -application headlessHello2_1.0.0.201210101509.jar

添加

根据 Paul 的回答,我将 config.ini 文件复制到了插件导出的目录中。

我还修改了脚本以使 -application 指向正确的 id。

R2_HOME=.
LIBS=plugins
JARS=.:\
$LIBS/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar:\
...
$LIBS/org.eclipse.osgi_3.7.2.v20120110-1415:\
headlessHello2_1.0.0.201210101509.jar

java -cp $JARS org.eclipse.core.launcher.Main -application headlessHello2.id2

运行此脚本会在configuration 目录中为我提供更多文件,但我仍有另一条错误消息。

org.osgi.framework.BundleException: The activator headlesshello2.Activator for bundle headlessHello2 is invalid
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:171)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)

可能出了什么问题?

【问题讨论】:

  • 您是否在运行依赖于 org.eclipse.core.runtime 的无头应用程序?
  • 我还将您的脚本提要一个 .jar 添加到 -application 中,但它应该是您的 plugin.xml 中定义的应用程序的 ID
  • 您能详细说明一下吗?我有 id2 作为 Eclipse 自动生成的 ID。我的插件是依赖于 org.eclipse.core.runtime 的无头应用程序,因为我按照本教程进行操作 - developertesting.com/archives/month200508/…
  • 您在上面列出了“-application headlessHello2_1.0.0.201210101509.jar”。这不是您的无头应用程序的 ID。但这不会阻止您的应用程序启动。您必须先弄清楚 config.ini。
  • 您是否在 Eclipse 中创建了有效的无头启动配置?这将告诉您所需的插件列表。您是否已导出您的应用程序?这将为您创建一个 config.ini。

标签: java eclipse plugins headless


【解决方案1】:

导出产品(甚至是基于插件的产品)对于提供运行 RCP 应用程序所需的内容要好得多。

但是,如果您已经为无头应用创建了启动配置,您可以通过查看 <workspace>/.metadata/.plugins/org.eclipse.pde.core/<launch-config.name> 来准确了解您需要的捆绑包以及可能的 config.ini 文件的外观。应该有一个 PDE 生成的 config.ini 来启动您的无头应用程序。

我仍然建议为您的应用程序创建一个 .product 文件并将其导出,除非您有理由不这样做。

【讨论】:

  • 我尝试导出 .product 文件,但出现了一些错误。我为它开了另一个帖子 - stackoverflow.com/questions/12831648/….
  • 我也更新了我原来的帖子。我可以删除第一个错误,但现在我得到了不同的错误。谢谢。
猜你喜欢
  • 1970-01-01
  • 2011-06-22
  • 2011-03-17
  • 2014-08-30
  • 2011-12-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多