Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be 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

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