waffel’s Weblog

März 28, 2011

Run eclipse RCP application via WebStart

Filed under: java — Thomas Wabner @ 7:07 pm
Tags: , , , , , , , ,

The last days I need to create a small prototype to demonstrate how to start a eclipse RCP application via webstart. After reading many tutorials and tipps I have now a working setup which I want to share with you.

The main tutorial which I followed was the eclipse help itself. But there are some hidden points which are important to respect.

Lets start:

You need 4 Projects:

  • Eclipse RCP plugin
  • Feature for the plugin
  • Wrapping feature for webstart
  • entry or start JNLP file

At least you need an webserver which can deliver your files.

Create eclipse RCP plugin with a example RCP application provided by eclipse:

This plugin will provide the RCP application with a small demo UI. In a larger project you will normally have more than one plugin. But for demonstration proposed this would be enough.

  1. From the eclipse main menu, go to File > New > Project… (the New Project wizard opens), select Plugin-in Development > Plug-in Project
  2. Press Next > enter „org.test.webstart.demo.plugin“ as Project name
  3. Press Next > change the Version to „0.1.0“
  4. Press Next > select RCP application with an view > press Finish

At this point you should have a small RCP „application“ which can started from eclipse. Select the project root > select Run from the menu > select Run As > Eclipse Application. Now you should see the demo UI.

Next we need a Eclipse feature project which uses the plugin.

Create eclipse feature which contains the plugin and a reference to the eclipse rcp feature:

We need a feature which depends on the demo plugin and on the eclipse rcp feature. The dependency to the eclipse rcp feature is required to export later all required plugins and features for webstart, to run the complete rcp application.

  1. In the eclipse main menu go to File > New > Project… (the New Project Dialog opens), select Plug-in Development > Feature Project
  2. Press Next > enter „org.test.webstart.demo.feature“ as project name > change the Version to „0.1.0“
  3. Press Next > select „org.test.webstart.demo.plugin“ from plug-ins list > press Finish

The feature editor opens. Now you need to add the eclipse rcp feature as included feature. To do so select Included Feature tab in the feature editor > add „org.eclipse.rcp“ as feature. Save and close the feature editor.

This feature contains now all you need to run your application as a full featured eclipse RCP application. Now we need another wrapping feature to get the Webstart launcher on board.

Create wrapping feature for webstart

This feature will be used to export all required JAR files with the eclipse java webstart exporter into a local filesystem.

  1. From the eclipse main menu select File > New > Project… (the New Project Dialog opens), select Plug-in Development > Feature Project
  2. Press Next > enter „org.test.webstart.demo.wrapperfeature“ as project name > change the Version to „0.1.0“
  3. Press Finish. The feature editor opens.

Now we need a dependency to the equinox launcher plugin and include our own feature.

  1. In the feature editor select the Plug-ins tab > add „org.eclipse.equinox.launcher“.
  2. Select the Included Feature tab > add „org.test.webstart.demo.feature“ > save the editor.
  3. From the project root select the eclipse main menu > select File > Export… > select Deployable Features (the export wizard opens)
  4. Press Select All
  5. In the Desitination tab select a directory where you want to export the JAR and JNLP files.
  6. In the Options tab only select Package as individual JAR archives. If you select Generate metadata repository nothing will be exported!
  7. In the JAR Signing tab fill in all fields with the information from your keystore. If you do not have an keystore you can create your own by follow these instructions.
  8. In the Java Webstart tab select Create JNLP manifests for the JAR archives > add the Site URL like http://localhost:8080/demoui-webstart > set 1.5+ for the JRE version > pess Finish

Now you should have in your destination folder a folder structure like
– features
– plugins

Under the features folder you should have some JNLP files. Because of an error in the eclipse exporter you need to adjust the JNLP files. For example the JNLP file of the feature looks like:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/demoui-webstart">
	<information>
		<title>Demo_rcp_feature</title>
		<offline-allowed/>
	</information>
	<security>
		<all-permissions/>
	</security>
	<component-desc/>
	<resources>
		<j2se version="1.5+" />
	</resources>
	<resources>
		<extension href="features/org.eclipse.rcp_3.5.2.R35x_v20100119-9SA0FxwFnoCU5XxWItFdXXb27BA6.jnlp" />
		<jar href="plugins/demo_rcp_0.1.0.201103241351.jar"/>
	</resources>
</jnlp

You need to change the tag and add the required vendor information. The resulting information tag should look like

	<information>
		<title>Demo_rcp_feature</title>	
		<vendor>Me</vendor>
		<offline-allowed/>
	</information

You need to do this for all JNLP files in the features folder!

Create start.jnlp file as the entry point for the web application

As a final step you need to create your entry JNLP file which is the starting point of your webstart application. Here is an example for start.jnlp:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp 
    spec="1.0+" 
    codebase="http://localhost:8080/demoui-webstart" 
    href="start.jnlp"> 
  <information>
    <!-- user readable name of the application -->
    <title> Demo UI Application </title>  
    <!-- vendor name -->
    <vendor>Me</vendor>
    <!-- vendor homepage --> 
    <homepage href="http://www.me.org" /> 
    <!-- product description -->
    <description>description</description> 
    <offline-allowed/>
  </information>
 
  <!--request all permissions from the application. This does not change-->
  <security>
    <all-permissions/>
  </security>
 
  <!-- The name of the main class to execute. This does not change-->
  <application-desc main-class="org.eclipse.equinox.launcher.WebStartMain">
    <argument>-nosplash</argument>
  </application-desc>
 
  <resources>
    <!-- Reference to the launcher jar. The version segment must be updated to the version being used-->
    <jar href="plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar"/>
 
    <!-- Reference to all the plugins and features constituting the application -->
    <!-- Here we are referring to the wrapper feature since it transitively refers to all the other plug-ins  necessary -->
    <extension 
        name="Wrapper feature"
        href="features/
org.test.webstart.demo.wrapperfeature_0.1.0.jnlp"/>
 
    <!-- Information usually specified in the config.ini -->
    <property 
        name="osgi.instance.area" 
        value="@user.home/Application Data/demoui-rcp"/>
    <property 
        name="osgi.configuration.area" 
        value="@user.home/Application Data/demoui-rcp"/>
    <!-- The id of the product to run, like found in the overview page of the product editor -->
    <property 
        name="eclipse.application" 
        value="org.demo.webstart.plugin.application"/>
  </resources>

  <!-- Indicate on a platform basis which JRE to use --> 
  <resources os="Windows">
    <j2se version="1.5+"/>
  </resources>
  <resources os="Linux">
    <j2se version="1.5+"/>
  </resources>
</jnlp>

Some remarks according the main JNLP file:

You need to adjust (or take care) of the lines 04, 30, 36, 48.

Line 04 defines the codebase. Every time you want to deploy you application on an websever you need to adjust the codebase (in every JNLP file in your project!) to the web application location.

Line 30 depends on you eclipse distribution (I have used eclipse 3.5 with some updates). You have to check the right version in your plugins folder and update the start.jnlp file.

Line 36 defines the starting feature JNLP file. This file itself refers to the other JNLP files in the features folder (which is automatically done from the eclipse exporter). You need to adjust this line if your project name differs from this example.

Line 48 defines the entry point to your application. This is the application ID from the example plugin. You can find the ID if you open the plugin editor of your example plugin. To do so open your example plugin and open the plugin.xml file. Under the tab Overview you can find the ID: „org.demo.webstart.plugin“. Now you also need to open the tab Extensions. Under the Extensions Details you can find the ID of your application. The complete application ID which you need to refer in the JNLP file is then „org.demo.webstart.plugin.application“.

If you now put the main JNLP file and the plugins + features folders under an webserver which delivers the files from http://localhost:8080/demoui-webstart/ you can see your test application. You should have following structure:

– start.jnlp
|– features
|– plugins

Simple click following link: http://localhost:8080/demoui-webstart/start.jnlp

Hint:
A small problem over which I stumbled while developing the example application:

If you start the application and you get from webstart an exception that plugin with *WTP* are not found, you can have a look into the JNLP files in the features folder. Some of these files define resources which are not exported by the eclipse webstart exporter. I have simple removed these resources from the JNLP files and it works.

Update:
I have created a Github repository with some code examples. You may clone my repo or send me patches with corrections.

Additional update:
I have now finished my github example and pushed also a complete working example. If you want to see how it works you can pull the https://github.com/waffel/Wordpress-examples/tree/master/org.waffel.worpress.demo.webstart.result project. With the help of maven you can simple start the application via

mvn jetty:run

This launches the jetty webserver and you can hit your browser to http://localhost:8080/demoui-webstart/start.jnlp

I have done all the mentioned steps from this blog for myself with a eclipse 3.7.

27 Kommentare »

  1. Hi,

    I tried this tutorial, but I got this error:
    Cannot map GET /C:/configuration/config.ini.bak HTTP/1.1 to file

    Do you know why?

    thx,
    Sasa

    Kommentar von Sasa Milicevic — April 15, 2011 @ 6:12 pm | Antworten

  2. I’m not sure where you’re getting your info, but good topic. I needs to spend some time learning more or understanding more. Thanks for fantastic info I was looking for this information for my mission.

    Kommentar von ipod preis — April 16, 2011 @ 1:43 pm | Antworten

  3. Excellent post with some good info, think i’ll share this on my twitter if you don’t mind and maybe even blogroll it depending on the feedback, thanks for sharing

    Kommentar von Julene Mamone — April 24, 2011 @ 3:30 am | Antworten

  4. Although some of websites may contain with many spam information,as to yours,it is time worthy for you to frequently look throught of your blog which with connotation.

    Kommentar von Rufus Greenman — April 24, 2011 @ 3:49 pm | Antworten

  5. Have you ever considered publishing an ebook or guest authoring on other sites? I have a blog based upon on the same ideas you discuss and would really like to have you share some stories/information. I know my viewers would enjoy your work. If you are even remotely interested, feel free to shoot me an e mail.

    Kommentar von Buford Grahe — April 25, 2011 @ 6:31 am | Antworten

  6. Simply killing some in between class time on Digg and I discovered your article . Not normally what I choose to read about, however it was absolutely value my time. Thanks.

    Kommentar von Herschel Garst — April 25, 2011 @ 6:19 pm | Antworten

  7. I like the helpful info you provide in your articles. I will bookmark your blog and check again here frequently. I’m quite sure I will learn lots of new stuff right here! Best of luck for the next!

    Kommentar von Joanne Ruano — April 26, 2011 @ 2:48 am | Antworten

  8. Hi~
    I’ve tried this tutorial many times… but I’ve got a very big problem..
    I’ve made a jnlp like this „start.jnlp“ as yours. and I’ve adjust some line follow you metioned above blog.
    but the Java Console show me this error „JNLP JREDESC in Component ignored : null“ after downloading a application. I would like you to give me some advice for fixing…

    Kommentar von terry — Mai 17, 2011 @ 9:46 am | Antworten

    • > You need to change the tag and add the required vendor information

      Actually, if you fill in the „Provider“ value in the plug-in editor, it will add that as the vendor.

      Kommentar von Patrick Rusk — August 25, 2011 @ 8:58 pm | Antworten

  9. 7.I like the helpful info you provide in your articles

    Kommentar von qwerw — Juni 2, 2011 @ 3:50 am | Antworten

  10. Hi,

    I have the same error: „JNLP JREDESC in Component ignored : null“ after downloading a application.
    Someone have resolve it?

    Thanks

    Kommentar von Thaiooo — Juli 26, 2011 @ 2:36 pm | Antworten

  11. I’m happy that I located this article. It fills in some of the blanks that I had in my mind prior to reading it!

    Kommentar von penny stock trading account — September 12, 2011 @ 10:21 pm | Antworten

  12. When I start your example, I get this error in the log file:
    Application error
    java.lang.RuntimeException: Application „org.waffel.wordpress.demo.webstart.plugin.application“ could not be found in the registry. The applications available are: org.eclipse.equinox.app.error.
    …………………….

    Can you please offer any help with this?

    Kommentar von Tanya Kruglikov — September 20, 2011 @ 8:17 pm | Antworten

    • How do you want to „start“ the application? You need to open your web browser and point to your JNLP file. Sorry, but I do not understand your problem at all.

      For sure … I do not have completed the example on GitHub … you need to do some more work to finish my example … hope I have time the next days to push a complete working example on GitHub.

      Kommentar von Thomas Wabner — September 22, 2011 @ 11:10 am | Antworten

      • Thomas, I’d really appreciate if you can post a complete working example of GitHub, since I’m trying to understand how to start RCP application with Java WebStart, and I’m running into the same problem every time.
        And yes – I did start it by pointing the browser to my JNLP file. I see the Java console start, then it disappears, and when I look in the log file, this is the full error that I’m seeing:
        java.lang.RuntimeException: Application „org.waffel.wordpress.demo.webstart.plugin.application“ 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:369)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
        at org.eclipse.equinox.launcher.WebStartMain.basicRun(WebStartMain.java:79)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
        at org.eclipse.equinox.launcher.WebStartMain.main(WebStartMain.java:57)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.sun.javaws.Launcher.executeApplication(Unknown Source)
        at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
        at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
        at com.sun.javaws.Launcher.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

        Any help will be appreciated.

        Kommentar von Tanya Kruglikov — September 24, 2011 @ 12:00 am

      • No the „complete“ working example can be found on github.

        Kommentar von Thomas Wabner — Oktober 13, 2011 @ 1:13 pm

  13. Have you considered applying to be a magazine writer? Very nice spelling!

    Kommentar von Bathroom Shower Tile Designs — September 21, 2011 @ 2:06 pm | Antworten

  14. Good web site! I really love how it is simple on my eyes and the data are well written. I’m wondering how I might be notified whenever a new post has been made. I’ve subscribed to your RSS feed which must do the trick! Have a great day!

    Kommentar von Jarvis Arturo — September 22, 2011 @ 12:29 am | Antworten

  15. Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your webpage? My website is in the very same niche as yours and my visitors would truly benefit from a lot of the information you present here. Please let me know if this okay with you. Thank you!

    Kommentar von cupolas weathervanes — September 22, 2011 @ 5:43 am | Antworten

  16. I was wondering if you ever considered changing the page layout of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or 2 pictures. Maybe you could space it out better?

    Kommentar von Werner Hansel — September 22, 2011 @ 6:31 am | Antworten

  17. I have followed all the steps as mentioned above and after deploying when i click on the link(on an web page), i find the application is downloaded but when i tried to run, it shows „JNLP JREDESC in Component ignored : null“ exception in java console.

    My settings

    os : Windows 7
    application server : Weblogic 10.3
    browser : IE
    Eclipse version :3.3.2

    Kommentar von sudipta — September 28, 2011 @ 11:11 pm | Antworten

    • I see nearly same message (not as a exception) … but my application works … you can have a look at github for a working example

      Kommentar von Thomas Wabner — Oktober 13, 2011 @ 1:06 pm | Antworten

  18. All good until ‚jar resources in jnlp are not signed by the same certificate‘.
    Made .jnlp extensions.
    After that ‚JNLP JREDesc in Component ignored: null‘.

    Anyone had this same problem?

    Kommentar von Bogdan — Oktober 6, 2011 @ 5:56 pm | Antworten

    • Hi Bogdan,

      I see the same meesages in my java console … but the application itself works without any problem.

      Kommentar von Thomas Wabner — Oktober 13, 2011 @ 1:05 pm | Antworten

  19. we have a RCP product on version 3.3.2, it has got 5 plugins.It runs well as RCP.
    When i try to run using web start, i can not see the GUI after ‘JNLP JREDesc in Component ignored: null’displayed on the console.

    though I could succesfully run demo rcp , as u mentioned in this tutorial
    please help me.

    Kommentar von RAZ — November 17, 2011 @ 9:08 pm | Antworten

  20. I think there is no problem about that error, I have a RCP app that works perfectly with JWS and keeps giving that error… For spanish people I’ve done a spanish guide in my blog http://kasasdev.blogspot.com/2012/02/rcp-con-java-web-start-jnlp.html. I hope that helps.

    Kommentar von Kasas — Februar 3, 2012 @ 11:05 am | Antworten

  21. Hi. First of all, thank you for this straightforward tutorial. I followed it step-by-step but the application is not running. It is giving me an error „JNLP JREDesc in Component ignored: null“ . I know many say that it is not an issue but what is the problem? The RCP app works by itself. Any assistance would be greatly appreciated.

    Kommentar von Jack — April 19, 2012 @ 3:12 am | Antworten


RSS feed for comments on this post. TrackBack URI

Hinterlasse eine Antwort zu Werner Hansel Antwort abbrechen

Erstelle kostenlos eine Website oder ein Blog auf WordPress.com.