Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » osgi.baseConfiguration.area does not resolve using a relative path(osgi.configuration.area in config.ini is ignored and the fallback location is used)
osgi.baseConfiguration.area does not resolve using a relative path [message #1231890] Wed, 15 January 2014 17:12 Go to next message
Steven Darnell is currently offline Steven Darnell
Messages: 18
Registered: November 2010
Junior Member
My company produces a small suite of RCP applications that are installed into the same shared location on Windows (C:\Program Files (x86)\MyCompany). They share a plug-ins directory but have separate configuration areas.

The desired location for osgi.configuration.area, osgi.user.area, and osgi.instance.area are in a user's roaming application data area (%APPDATA% on Windows XP/7). Due to localization requirements and differences in path locations between the OSes, it is not sufficient to build a path in the PRODUCT.ini launcher file starting from @user.home. Bug 241192 added the ability to specify environment variables in the config.ini file, but not in the PRODUCT.ini file.

This is the installation directory structure:

C:/Program Files (x86)/MyCompany
  configurationProgram1/config.ini
  configurationProgram2/config.ini
  configurationProgram3/config.ini
  jre/
  plugins/*.jar
  Program1.exe
  Program1.ini
  Program2.exe
  Program2.ini
  Program3.exe
  Program3.ini


This is an example PRODUCT.ini file:

--launcher.defaultAction
openFile
-clean
-vmargs
-Xmx768m
-Dosgi.locking=none
-Dosgi.requiredJavaVersion=1.7
-Dvisualvm.display.name=Program1
-Dosgi.baseConfiguration.area=file:configurationProgram1
-Dosgi.sharedConfiguration.area=file:configurationProgram1


This is an example config.ini file:

#Product Runtime Configuration File
eclipse.application=com.mycompany.app.program1.application
osgi.bundles.defaultStartLevel=4
eclipse.product=com.mycompany.app.program1.product
osgi.splashPath=platform:/base/plugins/com.mycompany.app.program1
osgi.bundles= ...
  org.eclipse.equinox.common@2:start,\
  ...
  org.eclipse.equinox.launcher.win32.win32.x86,\
  org.eclipse.swt.win32.win32.x86
osgi.configuration.area=$APPDATA$/MyCompany/Program1/configuration
osgi.user.area=$APPDATA$/MyCompany/Program1/user
osgi.instance.area=$APPDATA$/MyCompany/Program1/instance


If the working directory is in installation directory when the application is launched (e.g. double-click the exe in Windows Explorer, use a shortcut with the "Start in" variable defined as the installation directory), the relative path for osgi.baseConfiguration.area is resolved to the correct absolute path and osgi.configuration.area is set to the correct location in APPDATA. If the working directory is not the installation directory (e.g. open the application by double-clicking a file in Explorer associated with the program, launch from the command line from any non-installation directory), the program launches but osgi.baseConfiguration.area is still listed as a relative path and osgi.configuration.area reverts to its fallback position (for admins: C:/Program Files (x86)/MyCompany/configuration, for users: %USERPROFILE%/.eclipse/configuration). osgi.user.area and osgi.instance.area are correctly set in both instances.

My custom local configuration (configurationProgram1/config.ini) is clearly found, otherwise the application would fail to launch at all. However in the problem case, the Equinox launcher is either ignoring my osgi.configuration.area declaration or resetting it. I do not know how to step through the Equinox launcher start up class (org.eclipse.equinox.launcher.Main) to diagnose the problem further. The correct behavior is observed if osgi.baseConfiguration.area is defined as an absolute path rather than a relative path.

I realize my shared installation for multiple application is a unique case as the assumptions for a shared installation appear to be a single application with multiple local configurations for users and a single shared configuration. Still I suspect this is an Equinox bug; however, I wanted to ask the community whether I have misconfigured my installation or have misunderstood the documentation with regard to these osgi properties before doing so.
Re: osgi.baseConfiguration.area does not resolve using a relative path [message #1233189 is a reply to message #1231890] Sat, 18 January 2014 22:37 Go to previous message
Steven Darnell is currently offline Steven Darnell
Messages: 18
Registered: November 2010
Junior Member
While searching for solutions on why I could not use a relative path to define the location of osgi.baseConfiguration.area in eclipse.ini/PRODUCT.ini, I came upon this StackOverflow question: Can Eclipse launcher ini -configuration variable take a relative path?

The answer states that LocationManager (file in 3.9 branch) requires the plugins/ and configuration/ directories to be in the same directory and named exactly so in order to use a relative path, which must be defined by -startup and --launcher.library to define the plugins/ directory. I plan on submitting an Equinox bug to address this issue.
Previous Topic:Equinox support on Java7 and Solaris 10??
Next Topic:Where is LocationManager now located in master?
Goto Forum:
  


Current Time: Tue Sep 30 12:03:34 GMT 2014

Powered by FUDForum. Page generated in 0.03816 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software