Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

If your Eclipse-RCP application does not want to work with update site.

DZone's Guide to

If your Eclipse-RCP application does not want to work with update site.

· Java Zone
Free Resource

Just released, a free O’Reilly book on Reactive Microsystems: The Evolution of Microservices at Scale. Brought to you in partnership with Lightbend.

I hope, that it saves someone sometime...

We are using Eclipse 3.6. Recently we had to make our RCP application automatically updatable via Eclipse update site, using p2 technology. First of all we were building new version of applications with buckminster, everything seemed to be working, utnil we realized, that plugins are not actually updated. I am not sure what was the reason of this behavior, but after spending some time trying to made it working, we had to refuse of building with buckminster.

Then we tried to build the new version of application with eclipse own functionality - "Eclipse product export wizard", which can be opened from .product file editor "Overview" page. Strangely, updating was failing with exceptions like

"Can't remove application_path/jre/jre/lib/charsets.jar"

or something similar. We found, that new version of application is always bundled with its own JRE

(check /repository/binary/your_app_id_.feature.product_root.win32.win32.x86_version_number.jar)

. When it updates current version, it tries to replace JRE in your application_path/jre with one from the updated version. Due to the fact, that your application JRE is in use (it might not be, I'll talk about this later), it can not remove some jars, and accordingly, failing.

Here comes some interesting part. It seems, that in Eclipse 3.6 the flag "Bundle JRE for this environment with this product" (on the .product editor "Launching" page) is somehow not considered and thus, even it is not set, your product is still bundled with JRE, that is why i always tries to updates it.

Now, to prevent application of failing with above-mentioned error. We found following trick: in your application.ini fail you have to provide alternative path to the JRE, by specifying 

-vm
./your_jre/bin

 (Note: that new line have to be used between -vm and its argument).

If it is not provided, then by default Eclipse is looking for JRE in your product installation/JRE directory, if there is no javaw.exe and no -vm argument is pecified in .ini file, then it will fail with "No JRE can be found" error. If you will provide alternative path to JRE, in the runtime your application will be using this JRE and while updating it will still be updating JRE in your product installation folder.

Any feedback is greatly welcomed,

AlexG.

Strategies and techniques for building scalable and resilient microservices to refactor a monolithic application step-by-step, a free O'Reilly book. Brought to you in partnership with Lightbend.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}