bundleentry: resolution in Eclipse Plugins

Under Eclipse 3.0, when you try to resolve a file under your plugin, you will be presented with a URL that looks like this:

bundleentry://6/Config.properties

So, invoking getFile() on the URL will return null, as the protocol is not a file protocol. In order to get around this, you will have to use the following call:

Platform.resolve(url)

This incompatibility broke most of my plugins when trying to port and it took me some time to get it working. By the way, the preferred way to lookup for a file in 3.0 is using the Bundle API. So your code should probably look like this:

Bundle myBundle = MyPlugin.getDefault().getBundle();
URL url = Platform.resolve( myBundle.getEntry("/Config.properties") );

Leave a Reply