one common solution for this like:
- this.getClass().getResources()
but this way force you have to put your resources into src directory of Eclipse, this won't work under situation: your plugin is a pure library plugin, i.e. it hasn't src directory at all and it's not a java project, which hasn't java nature in its .project file
A better solution I find is:
[code]
Bundle myBundle = Platform.getBundle(MY_BUNDLE_ID);
URL fileUrl = myBundle.getResource("/" + resourceName);
[/code]
it support:
- your plugin can use any package style, say, as a jar, as a directory
- your resource can locate in src or just resource directory
- this.getClass().getResources()
but this way force you have to put your resources into src directory of Eclipse, this won't work under situation: your plugin is a pure library plugin, i.e. it hasn't src directory at all and it's not a java project, which hasn't java nature in its .project file
A better solution I find is:
[code]
Bundle myBundle = Platform.getBundle(MY_BUNDLE_ID);
URL fileUrl = myBundle.getResource("/" + resourceName);
[/code]
it support:
- your plugin can use any package style, say, as a jar, as a directory
- your resource can locate in src or just resource directory