Running Eclipse RCP applications in IntelliJ 8

I have seen a tutorial here, but it appears to be out of date and I wasn't able to get it to work with Ganymede.  Has anyone had any luck getting RCP applications working with Intellij?

6 comments
Comment actions Permalink

Eclipse RCP applications are basically OSGi applications with some Eclipse specialities on top. You can use the Osmorc plugin ( http://plugins.intellij.net/plugin/?id=1816 ) to work on any kind of OSGI applications. It includes a run configuration type for running Eclipse Equinox applications of which Eclipse RCP applications are a specialized kind.

Here are some pointers to get you started:
1. Install the Osmorc plugin through plugin manager
2. Import the Eclipse workspace for your RCP application through IDEA's Eclipse import feature.
3. IDEA should propose to create Osmorc facets for all your RCP pluginis.
3. Set up your Eclipse installation as a framework instance (Settings -> Osmorc -> IDE Settings -> Framework Definitions)
4. For RCP plugins that have a plugin.xml add the plugin.xml to the additional JAR contents in Osmorc facet settings (Project Structure -> Modules -> myRCPPlugin -> Osmorc -> Bundle JAR)
5. Add a new run configuration of type "Eclipse Equinox"
6. Specify either the product or application to run. If your product has the name "myproduct" and is defined in the plugin.xml of a plugin named "com.mycompany", then you need to specify the product as "com.mycompany.myproduct"
7. Start the run configuration and your Eclipse RCP application should be started.

Please also take a look at the documentation provided with the plugin. You'll find it in IDEA's help system (Help -> Help Topics -> Osmorc)

Best regards,
  Robert

0
Comment actions Permalink

Hi Robert,
     This is a very promising plugin.  Thanks, this will be valuable!

I have configured the plugin but am still running into some issues.  Some I worked around but others have me stumped.
1. After adding new frameworks (Eclipse Equinox), they are not immediately available, you just get a blank drop-down in the Osmorc->Project Settings->Framework Instance drop down.  I found if you restart Idea, it shows up.
2. My RCP application runs against a stand-alone rcp 3.4 installation, not an Eclipse installation.  Osmorc complained that it couldn't determine the version as it was missing the .eclipseproduct file.  I took the one from my Eclipse installation and dumped it there.
3. We use template tokens for things like version and app in our plugin.xml.  This is to enable us to update the version in one place and have it propogate into the various config files.  It's not a problem for Eclipse, but it is a problem for Osmorc (at least how I've got it configured).

I'm looking at my configuration side by side against my Eclipse run configuration.  There are some things that don't quite match up.
1. Under the main tab in the Run Configuration for an eclipse Application, there is a Text box called "Location:" right under "Workspace Data".  I don't see the same entry in Osmorc.  Is this important?

2. For runtime dir, I'm using "User Defined" and specifying the Working dir as the location of my Eclipse installation and the config dir as ${EclipseWorkspace}/.metadata/.plugins/org.eclipse.pde.core/.  This matches what I have in my Eclipse launcher.  Running with debug, the output matches the eclipse output, but the output is:

C:\jdks\jdk1.6.0_13\bin\java -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 8.1\bin" -Dfile.encoding=windows-1252 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 8.1\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 8.1\lib\util.jar" com.intellij.rt.execution.CommandLineWrapper "C:\Documents and Settings\downey\Local Settings\Temp\classpath10791.tmp" com.intellij.rt.execution.application.AppMain org.eclipse.equinox.launcher.Main -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -product com.acme.gui.@app.short@ -configuration "C:\projects\java\eclipseproj\.metadata\.plugins\org.eclipse.pde.core\GUI (Playground)" -data "C:\projects\java\eclipseproj\.metadata\.plugins\org.eclipse.pde.core\GUI (Playground)" -debug -consoleLog -clean
Configuration location:
    file:/C:/projects/java/eclipseproj/.metadata/.plugins/org.eclipse.pde.core/GUI (Playground)/
Configuration file:
    file:/C:/projects/java/eclipseproj/.metadata/.plugins/org.eclipse.pde.core/GUI (Playground)/config.ini loaded
Install location:
    file:/C:/projects/java/eclipseproj/lib/rcp-3.4/
Framework located:
    file:/C:/projects/java/eclipseproj/lib/rcp-3.4/plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
Framework classpath:
    file:/C:/projects/java/eclipseproj/lib/rcp-3.4/plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
Debug options:
    file:/C:/projects/java/eclipseproj/.metadata/.plugins/org.eclipse.pde.core/GUI (Playground)/.options loaded
Time to load bundles: 141
!SESSION 2009-05-15 14:29:42.883 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_13
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=${target.os}, ARCH=${target.arch}, WS=${target.ws}, NL=${target.nl}
Framework arguments:  -product com.acme.gui.@app.short@
Command-line arguments:  -os ${target.os} -ws ${target.ws} -arch ${target.arch} -product com.acme.gui.@app.short@ -data C:\projects\java\eclipseproj\.metadata\.plugins\org.eclipse.pde.core\GUI (Playground) -debug -consoleLog -clean

!ENTRY org.eclipse.equinox.app 0 0 2009-05-15 14:29:43.586
!MESSAGE Product com.acme.gui.@app.short@ could not be found.

!ENTRY org.eclipse.osgi 2 0 2009-05-15 14:29:43.617
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2009-05-15 14:29:43.617
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.core.runtime.compatibility_3.2.0.v20071008.jar/ was not resolved.
!SUBENTRY 2 org.eclipse.core.runtime.compatibility 2 0 2009-05-15 14:29:43.617

,,,,
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.
    at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:236)
    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:386)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:44)

0
Comment actions Permalink

Hi Adam,

1. Unfortunately that's a bug I'm trying to get rid of for some time now. Sometime it manifests itself and often it doesn't.
2. It's no problem to use a standalone RCP installation, but you need a version that was created for the hardware and operating system you are using. Such downloads always also contain an .eclipseproduct file. Please also make sure that the specific fragment bundles for your OS are included in your installation. The Windows installation includes a org.eclipse.swt.win32.win32.x86_3.4.1.v3449c.jar for example and several others specific to the Windows version.

The Working directory is the directory used as the working directory for the java process. The config dir is where the config.ini is created and where Equinox will put its caches. It's probably a good idea to take fresh directories for the run configurations in IDEA. If you don't need to edit the config.ini yourself or to put any other resources into one of those directories, please start with the "Osmorc controlled" variant. That will recreate the caches and config.ini each time to start the run configurations. That way you'll be sure there's no caching problem involved if something doesn't work.

Did you add the plugin.xml of the module com.acme.gui to the additional JAR contents in the Osmorc facet configuration of that module? Looks like Equinox didn't find the definition of the product.

If those template tags work in Eclipse then they should also work with Osmorc since Osmorc doesn't interpret the name of the product. Osmorc just passes it to Equinox.

Best regards,
  Robert

0
Comment actions Permalink

Robert,
     Thanks again for your help.  I do have the plugin.xml added to the "Additional Jar Contents" entry.  It definitely is reading the plugin.xml because I have declared the version number in my plugin.xml file as @version@ and it chokes on it.

C:\jdks\jdk1.6.0_13\bin\java -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 8.1\bin" -Dfile.encoding=windows-1252 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 8.1\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 8.1\lib\util.jar" com.intellij.rt.execution.CommandLineWrapper "C:\Documents and Settings\downey\Local Settings\Temp\classpath18441.tmp" com.intellij.rt.execution.application.AppMain org.eclipse.equinox.launcher.Main -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -debug -product com.acme.gui.@app.short@ -configuration "C:\Documents and Settings\downey\.IntelliJIdea8x\system\osmorc\runtmp1242655453684" -data "C:\Documents and Settings\downey\.IntelliJIdea8x\system\osmorc\runtmp1242655453684" -debug -consoleLog
Configuration location:
    file:/C:/Documents and Settings/downey/.IntelliJIdea8x/system/osmorc/runtmp1242655453684/
Configuration file:
    file:/C:/Documents and Settings/downey/.IntelliJIdea8x/system/osmorc/runtmp1242655453684/config.ini loaded
Install location:
    file:/C:/projects/java/eclipseproj/lib/rcp-3.4/
Framework located:
    file:/C:/projects/java/eclipseproj/lib/rcp-3.4/plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
Framework classpath:
    file:/C:/projects/java/eclipseproj/lib/rcp-3.4/plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
Debug options:
    file:/C:/Documents and Settings/downey/.IntelliJIdea8x/system/osmorc/runtmp1242655453684/.options not found
!SESSION 2009-05-18 10:04:13.810 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_13
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=${target.os}, ARCH=${target.arch}, WS=${target.ws}, NL=${target.nl}
Framework arguments:  -product com.acme.gui.@app.short@
Command-line arguments:  -os ${target.os} -ws ${target.ws} -arch ${target.arch} -debug -product com.acme.gui.@app.short@ -data C:\Documents and Settings\downey\.IntelliJIdea8x\system\osmorc\runtmp1242655453684 -debug -consoleLog

!ENTRY org.eclipse.osgi 4 0 2009-05-18 10:04:14.295
!MESSAGE Error installing bundle: reference:file:../../out/production/com.acme.gui.jar/
!STACK 0
org.osgi.framework.BundleException: For input string: "@version@"
    at org.eclipse.osgi.framework.internal.core.Framework.installWorkerPrivileged(Framework.java:991)
    at org.eclipse.osgi.framework.internal.core.Framework$2.run(Framework.java:854)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.Framework.installWorker(Framework.java:905)
    at org.eclipse.osgi.framework.internal.core.Framework.installBundle(Framework.java:849)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.installBundle(BundleContextImpl.java:234)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.installBundles(EclipseStarter.java:1107)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.loadBasicBundles(EclipseStarter.java:646)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.access$1(EclipseStarter.java:623)
    at org.eclipse.core.runtime.adaptor.EclipseStarter$1.bundleChanged(EclipseStarter.java:308)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:1234)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:211)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:141)
    at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1518)
    at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1469)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:281)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.launch(StartLevelManager.java:247)
    at org.eclipse.osgi.framework.internal.core.SystemBundle.resume(SystemBundle.java:201)
    at org.eclipse.osgi.framework.internal.core.Framework.launch(Framework.java:644)
    at org.eclipse.osgi.framework.internal.core.OSGi.launch(OSGi.java:51)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:313)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:44)
Caused by: java.lang.NumberFormatException: For input string: "@version@"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:447)
    at java.lang.Integer.parseInt(Integer.java:497)
    at org.osgi.framework.Version.<init>(Version.java:128)
    at org.osgi.framework.Version.parseVersion(Version.java:209)
    at org.eclipse.core.runtime.internal.adaptor.EclipseStorageHook.generateManifest(EclipseStorageHook.java:415)
    at org.eclipse.core.runtime.internal.adaptor.EclipseStorageHook.getGeneratedManifest(EclipseStorageHook.java:375)
    at org.eclipse.core.runtime.internal.adaptor.EclipseStorageHook.createCachedManifest(EclipseStorageHook.java:367)
    at org.eclipse.core.runtime.internal.adaptor.EclipseStorageHook.getManifest(EclipseStorageHook.java:472)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.loadManifest(BaseStorage.java:297)
    at org.eclipse.osgi.internal.baseadaptor.BundleInstall.begin(BundleInstall.java:82)
    at org.eclipse.osgi.framework.internal.core.Framework.installWorkerPrivileged(Framework.java:938)
    ... 39 more


When I manually edit the plugin.xml and change @version@ to a number,then it says it can't find the application.

Like I said, there are some options that the Eclipse run configuration has that we're using that I can't find analogues to in Osmorc.  From eclipse's run configuration, we use:
1. Main->Workspace Data -> Location
2. Common ->Save As -> Shared File

Do these map to anything in Osmorc?

In the meantime, I will read up on Equinox to see if I can fill in the huge gaps in my knowledge.:-)

0
Comment actions Permalink

Hi Adam,

The directory specified in "Main->Workspace Data -> Location" is the data directory of Equinox. Osmorc either sets it to a temp directory it creates before starting Equinox or the directory specified as "Config Dir".
With "Common ->Save As -> Shared File" you only specify that you want to share a run configuration (check it into Subversion or CVS). Equinox itself doesn't need it.

Would it be possible for you to send me your project or some stripped down variant on which it is possible to reproduce the problem. This way I'll probably be able to help you faster.

If that is not possible, could you send me the console output when starting the application in Eclipse. You can activate debug console output by adding " -debug -consoleLog" to the "Program Arguments" on the Arguments tab of the run configuration. Also intresting would be the config.ini file that can be found in the ".metadata\.plugins\org.eclipse.pde.core\myLaunchConfigName" in the workspace of your project.

My e-mail address is robert at the domain beeger.net.

Best regards,
  Robert

0
Comment actions Permalink

Hello.

Yesterday I have tried to use the guide you refer to with IDEA 8 and Eclipse 3.4.1. For me it works. The UI descriptions are really obsolete, though. I think we will update the document.

You can write here about the step that doesn't work for you, and I will try to recheck that point. Or wait for updated guide first.

Alexander.

0

Please sign in to leave a comment.