RCP, p2, Vista and VirtualStore

I have an RCP application that uses p2 and needs to run on all of our platforms (this uses 3.4.2).  Everything was great until Vista came along.  On Vista when going to the Software Updates… dialog it gets the “not properly configured” dialog and won’t let me do the fun p2 stuff.

The problem is that Vista does not like it (sort of) if you try to write things in the Program Files directory.  You can write as much as you like only during the install process, and there seems to be some way that it writes a “virtual store” into this area when the app is running, but p2 will not work with this.

The solution that I have found is to (my app is called “osdt”, which is also the name of my launcher executable):

  1. Add
    • -Dosgi.configuration.area=@user.home/osdt/configuration

    to my Launching Arguments in my product file in the VM Arguments section for all platforms.  This tells it to look for the configuration area in a location that’s relative to the Java “user.home” system property (c:/Users/<User name> on Vista and c:/Documents and Settings/<User name> on XP.)

  2. Add the following into my config.ini file:
    • eclipse.p2.data.area=@config.dir/../p2
    • osgi.instance.area=@user.home/osdt/workspace
  3. This makes sure that the p2 data area is relative to the configuration and my workspace is also created relative to the user’s home directory.

  4. Teach my installer to put the configuration and p2 directories in the expected location. I use install4j – and the key here is to have it come up with the variable setting the location to install these things at install time using the “user.home” system property from Java so that the Eclipse @user.home and where the kit is being installed to will always be in sync.

All of this was great, but it did not work, and I was finding that no matter what I did to my osdt.ini file it had no effect. The problem was that the Vista “virtual store” mechanism had written my information from the previous installs and that was silently overriding what was in the Program Files folder. In general, if you write something to the Program Files folder, it will really be written to c:/Users/<User name>/AppData/Local/VirtualStore/Program Files, and whatever is at this virtual store location will silently take precedence over what is in the Program Files folder. Once I deleted the stuff in the virtual store location everything was fine.

Advertisements

About francisu

VP, Architecture at Talend, overall responsible for product architecture and governance. Also maintainer of the Jenkins EC2 plugin.
This entry was posted in Uncategorized. Bookmark the permalink.

6 Responses to RCP, p2, Vista and VirtualStore

  1. Alex Blewitt says:

    It’s always been crap that Eclipse writes to the program install area. It’s a problem with the Mac installs too. It really should be absolutely unnecessary to write there but sadly Eclipse is designed with poor Windows standards as it’s main focus and pays lip service to standard Unix or Mac standards.

  2. Francis Upton says:

    @alex I agree, however it’s actually completely modular in how you can decompose the osgi stuff (and p2) into different places. The problem is that it’s not a habit to set it up correctly. It’s really just a matter of configuration and documentation. And well learning the hard way.

  3. John Arthorne says:

    When the framework starts, it tries to find an appropriate writeable location for the configuration folder. When the install directory is not writeable, or when running on Vista and the install directory is under “Program Files”, the framework will default to putting the configuration folder under user-home. This works perfectly in the Eclipse platform and Eclipse SDK itself. I suspect you had somewhere explicitly set the configuration directory to be under the install directory to encounter this problem.

  4. Francis Upton says:

    @John, is this true for 3.4.2 as well? I’m pretty sure I did not specify the osgi.configuration.area property anywhere, nor did I pass the corresponding flag to the launcher? I do need to know ahead of time where it’s going to go, as I have stuff in the config.ini (and stuff for p2 due to the pre-installation that’s done when building the kit) that needs to go in the configuration folder.

  5. John Arthorne says:

    Yes, this has been true since 3.2.2:

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=209192

  6. Francis Upton says:

    @john I think the issue is that I provided a configuration folder when I installed in the Program Files directory, so part of this checking must assume that if there is already a configuration folder in the Program Files directory then it should just use that. Of course that was my mistake, I should not have provided it there since it was not writable.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s