Search code examples
javaeclipse-pde

Read eclipse installation path using eclipse API


I opened eclipse 3.3.2. Now i need to get the current eclispe installation path. Is

there any eclipse API to get the eclipse installation path? Please help in this regard.

Thanks in Advance..

Snehal


Solution

  • Since eclipse3.4 and the p2 mechanism, you coud use org.eclipse.osgi.service.datalocation.Location, which represents a URL.

    That interface includes **ECLIPSE_HOME_FILTER**, a constant which defines the filter string for acquiring the service which specifies the eclipse home location (i.e. "eclipse.home.location".)

    But in eclipse3.3, just query the property value "eclipse.home.location", as in:

    System.getProperty("eclipse.home.location");