this.getClass().getClassLoader().getResourceAsStream(IMAGE_URL)
is working perfectly when I am trying to run my RCP application from Eclipse. But, when I am running it as a product, it is not running.
this.getClass().getClassLoader().getResourceAsStream()
returns `null´. Any clue how to solve this?
Note: I have tried to solve this using Activator.getDefault().getBundle()
. But this as well is not working. It seems that Activator.getDefault() = null
which means that plugin is not actiavted. I also tried to put a break point there. Indeed the plugin variable in null
in Activator.
What should I do?
Use FileLocator
:
Bundle bundle = FrameworkUtil.getBundle(getClass());
InputStream is = FileLocator.openStream(bundle, new Path("relative path"), false);
Other methods of FileLocator
will give you a URL instead of a stream.