Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

FAQ How do I find out the install location of a plug-in

Revision as of 13:31, 31 December 2009 by Kosashi.gmail.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This took me far too many hours, so I thought I would share. In your activator, implement the following:

String rootDirectory;
 
public void start(BundleContext context) throws Exception {
    super.start(context);
    //...
    URL entry = context.getBundle().getEntry("/"); 
    rootDirectory = FileLocator.toFileURL(entry).getPath(); 
}


However, this solution may create unnecessary "/" at the beginning of the path. You may consider using this code instead:

String location = FileLocator.getBundleFile(context.getBundle()).getAbsolutePath();

Back to the top