如何使RCP应用程序真正独立? [英] How to make RCP application really standalone?

查看:146
本文介绍了如何使RCP应用程序真正独立?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我创建 Headless Hello RCP 应用程序






我可以在任何普通的java应用程序的Eclipse调试器下运行它。它运行并打印Hello world到Eclipse控制台。



现在如何使它真正独立,即运行没有我的CURRENT Eclipse?



导出为可运行的JAR不适用于此类项目。



导出到Eclipse产品也不起作用



更新



如果我为项目创建产品文件,然后导出到产品开始工作,但应用程序本身在运行时开始崩溃。这可能是由于我在产品文件创建过程中发生的错误猜测。



首先创建的产品文件看起来没有为我填满:





尝试填写产品下拉列表我使用新的按钮,并从我当前的项目创建产品





在填充应用程序单元格时,我使用了一些猜测。我设置了一些条目,这与我当前的项目名称不一样。



导致应用程序崩溃,出现异常:

 !ENTRY org.eclipse.equinox.launcher 4 0 2013-12-18 03:29:41.305 
!MESSAGE启动Eclipse平台的异常:
!堆栈
java.lang.ClassNotFoundException:java.net.URLClassLoader $ 1.run(URLClassLoader.java:366)上的org.eclipse.core.runtime.adaptor.EclipseStarter
java.net上的
。 URLClassLoader $ 1.run(URLClassLoader.java:355)
在java.security.AccessController.doPrivileged(本机方法)
在java.net.URLClassLoader.findClass(URLClassLoader.java:354)
在java.lang.ClassLoader.loadClass(ClassLoader.java:424)
在java.lang.ClassLoader.loadClass(ClassLoader.java:357)
在org.eclipse.equinox.launcher.Main.invokeFramework (Main.java:633)
在org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
在org.eclipse.equinox.launcher.Main.run(主.java:1450)
在org.eclipse.equinox.launcher.Main.main(Main.java:1426)

更新2



此常见问题条目。为您的RCP应用程序创建一个产品,然后专注于教程(部署)的第2点。



祝你好运。


If I create Headless Hello RCP application

I can run it under Eclipse debugger as any normal java application. It runs and prints "Hello world" into Eclipse console.

Now how to make it really standalone, i.e. running without MY CURRENT Eclipse?

Exporting to runnable JAR does not work with such a project.

Exporting to Eclipse product also does not work for it.

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

I used some guessing when filling Application cell. 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

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.

PLUGIN.XML

When adding products extension point to plugin.xml, Eclipse warns that

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.

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:

!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

I found the following points:

1) Product should be described both in plugin.xml file and in .product file. In plugin.xml file the product is represented as a contribution to org.eclipse.core.runtime.products point (<extension> tag). This tag of plugin.xml file can be created automatically by .product file creation wizard, by New button.

2) Application is also represented in plugin.xml file as contribution to org.eclipse.core.runtime.applications. This should be preconfigured before running .product creation wizard. The id of the application in plugin.xml file is not fully qualified. FQN is appeared if prepended by plugin name, which is written in MANIFEST.MF file. So, while running .product creation wizard one should calculate FQN of an application in mind and set it.

3) The result of final running depends not only on all above, but also on Debug As -> Debug Configurations or Run As -> Run Configurations. There is a Plug-ins tab there with several magic controls:

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

After adding org.eclipse.core.runtime to dependencies of .product file, the last problem was solved. 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)

UPDATE 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).

Good luck.

这篇关于如何使RCP应用程序真正独立?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆