无头日食的config.ini设置

从这篇文章中 ,当我尝试执行无头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) 

我用google搜索这个问题的答案: 启动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) 

可能有什么问题?

导出产品(甚至是基于插件的产品)可以更好地提供运行RCP应用程序所需的内容。

但是如果你已经为无头应用程序创建了一个启动配置,你可以通过查看/.metadata/.plugins/org.eclipse.pde.core/来确切地找到你需要的bundle以及config.ini文件的样子/.metadata/.plugins/org.eclipse.pde.core/ 。 应该有一个PDE生成的config.ini来启动你的无头应用程序。

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