希望 Eclipse 使用特定的 config.ini,但设置不同的配置区域

发布于 2024-10-04 14:57:07 字数 2245 浏览 1 评论 0原文

简而言之,我的问题是这样的:

我想使用特定的 config.ini 文件运行基于 Eclipse 的程序,该文件不在默认目录中,即它不在../eclipse/configuration/config.ini 但同时我希望配置区域位于不同的位置,即用户主目录。

原因与使用多个不同的 config.ini 文件有关,并且保存文件的配置区域是只读的。

当在我的 config.ini 中启动该工具时

${JAVA_HOME}/bin/java 
-Dosgi.baseConfiguration.area=$INSTALLATION/$CONFIGURATION/eclipse/configuration\
-jar $INSTALLATION/eclipse/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar \

(除其他外):

 [email protected]/tmp/eclipse_data/

我几乎得到了我想要的一切:使用正确的 config.ini 文件,该工具开始将数据缓存到正确的位置,并且仅在那里。但有一个小缺点,即该工具无法启动...我收到错误消息:

!ENTRY org.eclipse.osgi 4 0 2010-11-29 19:17:06.914 !MESSAGE 应用程序错误 !堆栈1 java.lang.IllegalStateException:无法获取应用程序服务。确保 org.eclipse.core.runtime 包已解析并启动(请参阅 config.ini)。 在 org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74) 在 org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)

如果我更改为该

${JAVA_HOME}/bin/java -Dawt.toolkit=sun.awt.X11.XToolkit \
-Dosgi.configuration.area=$INSTALLATION/$CONFIGURATION/eclipse/configuration \
-jar $INSTALLATION/eclipse/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar \

工具可以工作,但开始将数据保存到我的写保护区域中。

这不是我的 config.ini 文件中的包定义的问题,因为它们在第二种情况下工作。

有几种解决方法,但首先我要尝试看看是否有办法让这项工作像我们首先想要的那样工作。

更新:按照下面的 Kanes 建议,我发现只加载了一个包,org.eclipse.osgi_3.6.0.v20100517。当我检查 grepcode 抛出异常我发现这一行:

if (failOnNoDefault && runnable == null)
throw new IllegalStateException(EclipseAdaptorMsg.ECLIPSE_STARTUP_ERROR_NO_APPLICATION);

所以我的可运行为空。不知道为什么,但我认为这是一个迹象,表明我必须使用一些解决方法。

So my problem in short is this:

I want to run my eclipse based program with a specific config.ini file which is not in the default dir, i.e it is not in ../eclipse/configuration/config.ini but at the same time I want the configuration area to be in a different location, the users home directory.

The reasons have to do with using several different config.ini files and the configuration area where the files are saved is readonly.

When starting up the tool with

${JAVA_HOME}/bin/java 
-Dosgi.baseConfiguration.area=$INSTALLATION/$CONFIGURATION/eclipse/configuration\
-jar $INSTALLATION/eclipse/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar \

and this in my config.ini (amongst other things):

 [email protected]/tmp/eclipse_data/

I get almost everything I want: The right config.ini file is used, the tool starts to cache data to the right place and only there. But with the little downside that the tool doesnt start up... I get the error message:

!ENTRY org.eclipse.osgi 4 0 2010-11-29 19:17:06.914
!MESSAGE Application error
!STACK 1
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:74)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)

If I change to

${JAVA_HOME}/bin/java -Dawt.toolkit=sun.awt.X11.XToolkit \
-Dosgi.configuration.area=$INSTALLATION/$CONFIGURATION/eclipse/configuration \
-jar $INSTALLATION/eclipse/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar \

the tool works, but starts to save data into my writeprotected area.

It is not an issue with the bundle definition in my config.ini file, since they work in the second scenario.

There are several workarounds for this, but first I'm gonna try to see if there is a way to make this work like we want to first.

Update: Following Kanes suggestion below, I found that only one bundle was being loaded, org.eclipse.osgi_3.6.0.v20100517. When I examined the eclipse code in grepcode that throws the exception I found this line:

if (failOnNoDefault && runnable == null)
throw new IllegalStateException(EclipseAdaptorMsg.ECLIPSE_STARTUP_ERROR_NO_APPLICATION);

So my runnable is null. Not sure why, but I think it's a sign that I got to use some workaround.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随风而去 2024-10-11 14:57:07

在第一种方式中,您必须添加“osgi.bundles”作为您的虚拟机参数。该错误消息是由于捆绑包未安装到 OSGi 框架中而导致的,该框架自 eclipse 3.4 起由捆绑包“org.eclipse.equinox.simpleconfigurator”负责。

-Dosgi.bundles=file/<eclipsedir>/plugins/org.eclipse.equinox.simpleconfigurator_1.0.200.v20100503.jar@1\:start

In first way, you have to add 'osgi.bundles' as your vm argument. The error message is caused by the bundles aren't installed into the OSGi framework that is responsibility of bundle 'org.eclipse.equinox.simpleconfigurator' since eclipse 3.4.

-Dosgi.bundles=file/<eclipsedir>/plugins/org.eclipse.equinox.simpleconfigurator_1.0.200.v20100503.jar@1\:start
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文