Suzan Cioc
Suzan Cioc

Reputation: 30097

How to make RCP application really standalone?

If I create Headless Hello RCP application

enter image description here enter image description here

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:

enter image description here

Trying to fill Product dropdown I use New button and create product from my current project

enter image description here

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.

enter image description here

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:

enter image description here

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:

enter image description here

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?

Upvotes: 1

Views: 1521

Answers (2)

SaurabhJinturkar
SaurabhJinturkar

Reputation: 554

Please check log file. There might be some exception occurring while startup. You can find log file at <workspaceLoaction>/.metadata/.log location.

Upvotes: 0

Georgian
Georgian

Reputation: 8960

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.

Upvotes: 2

Related Questions