[英]How to make RCP application really standalone?
If I create Headless Hello RCP
application 如果我创建
Headless Hello RCP
应用程序
I can run it under Eclipse debugger as any normal java application. 我可以像任何普通的Java应用程序一样在Eclipse调试器下运行它。 It runs and prints "Hello world" into Eclipse console.
它运行并将“ Hello world”打印到Eclipse控制台中。
Now how to make it really standalone, ie running without MY CURRENT Eclipse? 现在如何使其真正独立,即在没有MY CURRENT Eclipse的情况下运行?
Exporting to runnable JAR does not work with such a project. 导出到可运行的JAR不适用于此类项目。
Exporting to Eclipse product also does not work for it. 导出到Eclipse产品也不适用于它。
UPDATE UPDATE
If I create product file for the project, then exporting to product starts to work, but the application itself starting to crash while running. 如果我为该项目创建产品文件,则可以导出到产品,但是应用程序本身在运行时开始崩溃。 This is probably due to wrong guesses I made during product file creation.
这可能是由于我在创建产品文件时所做的错误猜测。
Firstly created product file looks not full filled for me: 首先创建的产品文件对我来说并不完整:
Trying to fill Product
dropdown I use New
button and create product from my current project 尝试填写
Product
下拉菜单时,我使用“ New
按钮,并从当前项目中创建产品
I used some guessing when filling Application
cell. 我在填充
Application
单元格时使用了一些猜测。 I set there some entry, which corresponds somehow with my current project name. 我在此处设置了一些条目,该条目某种程度上与我当前的项目名称相对应。
Resulting application crash with an exception: 导致应用程序崩溃,但出现以下异常:
!ENTRY org.eclipse.equinox.launcher 4 0 2013-12-18 03:29:41.305
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:633)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
UPDATE 2 更新2
This FAQ entry http://wiki.eclipse.org/FAQ_How_do_I_create_an_Eclipse_product%3F describes some procedure, which does not work in reality. 此常见问题解答条目http://wiki.eclipse.org/FAQ_How_do_I_create_an_Eclipse_product%3F描述了一些过程,该过程实际上不起作用。
PLUGIN.XML plugin.xml中
When adding products extension point to plugin.xml, Eclipse warns that 在将产品扩展点添加到plugin.xml时,Eclipse警告说
A minimum of 1 'provider' elements must be specified.
A minimum of 1 'product' elements must be specified.
It is not described in the FAQ, whether this should be done and how. 在FAQ中没有描述它是否应该执行以及如何执行。
Suppose we remain file as is. 假设我们保持原样。
PRODUCT FILE 产品资料
Later when creating product file, it is also unclear how to fill it: 稍后在创建产品文件时,也不清楚如何填充它:
If filled as written in the FAQ (see above, only product id is set), the resulting application does not run with exception: 如果按照FAQ中的说明进行填写(请参见上文,仅设置产品ID),则生成的应用程序将不会运行,但会出现以下异常:
!SESSION Wed Dec 18 13:32:36 MSK 2013 ------------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2013-12-18 13:32:36.300
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:633)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
UPDATE3 UPDATE3
I found the following points: 我发现以下几点:
1) Product should be described both in plugin.xml
file and in .product
file. 1)产品应在
plugin.xml
文件和.product
文件中进行描述。 In plugin.xml
file the product is represented as a contribution to org.eclipse.core.runtime.products
point ( <extension> tag
). 在
plugin.xml
文件中,产品表示为对org.eclipse.core.runtime.products
点( <extension> tag
)的贡献。 This tag of plugin.xml
file can be created automatically by .product
file creation wizard, by New
button. 可以通过
.product
文件创建向导的“ New
按钮自动创建plugin.xml
文件的此标记。
2) Application is also represented in plugin.xml
file as contribution to org.eclipse.core.runtime.applications
. 2)在
plugin.xml
文件中,应用程序还表示为对org.eclipse.core.runtime.applications
贡献。 This should be preconfigured before running .product
creation wizard. 在运行
.product
创建向导之前,应该对此进行预配置。 The id
of the application in plugin.xml
file is not fully qualified. plugin.xml
文件中应用程序的id
不完全限定。 FQN is appeared if prepended by plugin name, which is written in MANIFEST.MF
file. 如果以在
MANIFEST.MF
文件中编写的插件名称开头,则会出现FQN。 So, while running .product
creation wizard one should calculate FQN of an application in mind and set it. 因此,在运行
.product
创建向导时,应记住计算应用程序的FQN并进行设置。
3) The result of final running depends not only on all above, but also on Debug As -> Debug Configurations
or Run As -> Run Configurations
. 3)最终运行的结果不仅取决于以上所有内容,还取决于
Debug As -> Debug Configurations
或Run As -> Run Configurations
。 There is a Plug-ins
tab there with several magic controls: 这里有一个带有几个魔术控件
Plug-ins
选项卡:
By default even main application is not included. 默认情况下,甚至不包括主应用程序。
Concerning all this I was able to walk approximately entire way, but finally stuck at new obstacle: 关于所有这些,我能够走近一整条路,但最终陷入了新的障碍:
When running final exported application, I get an exception: 运行最终导出的应用程序时,出现异常:
!SESSION Wed Dec 18 19:04:36 MSK 2013 ------------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2013-12-18 19:04:36.695
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.RuntimeException: Could not find framework
at org.eclipse.equinox.launcher.Main.getBootPath(Main.java:992)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:571)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
UPDATE 4 更新4
After adding org.eclipse.core.runtime
to dependencies of .product
file, the last problem was solved. 将
org.eclipse.core.runtime
添加到.product
文件的依赖项后,解决了最后一个问题。 The next problem is an excpetion 下一个问题是排他性
!SESSION 2013-12-18 19:43:31.136 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_40
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86_64
!ENTRY org.eclipse.osgi 4 0 2013-12-18 19:43:31.924
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "MyApp.id1" could not be found in the registry. The applications available are: org.eclipse.equinox.app.error.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
(application id is different in this run, but is correct) (此运行中的应用程序ID不同,但正确)
UPDATE 5 更新5
I found that my application class does not present anywhere in exporting directory. 我发现我的应用程序类不在导出目录中的任何位置。
How to force it to go there? 如何迫使它去那里?
What you need is a Product File in your app. 您需要的是应用程序中的产品文件 。 Create a product for your RCP App, then focus on point #2 of the tutorial (deployment).
为您的RCP App创建产品,然后专注于教程的第2点(部署)。
Good luck. 祝好运。
Please check log file. 请检查日志文件。 There might be some exception occurring while startup.
启动时可能会发生一些异常。 You can find log file at
<workspaceLoaction>/.metadata/.log
location. 您可以在
<workspaceLoaction>/.metadata/.log
位置找到日志文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.