论坛首页 入门技术论坛

load any resource from any installed plugin of Eclipse

浏览 1634 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2007-07-24  
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:
 Bundle myBundle = Platform.getBundle(MY_BUNDLE_ID);
 URL fileUrl = myBundle.getResource("/" + resourceName);


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
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics