Problem reading resources from jar inside Idea.
We use Thread.currentThread().getContextClassLoader().getResourceAsStream(path) inside our jars to access resources.
This does not appear to work when the jar is inside an Idea plugin - it returns null.
Can you suggest a work around please.
MArkee
请先登录再写评论。
Can't you use getClass().getClassLoader().getResourceAsStream(path)?
mark stephens wrote:
--
Martin Fuhrer
Fuhrer Engineering AG
http://www.fuhrer.com
Its called statically. Any ideas?
It works with ClassName.class.getResourceAsStream()
Back in business :)
MArkee
I've the same problem. I have file-template, placed in jar (after compiling plugin). When installing this plugin in IDEA - it can't find this file inside my JAR, but it is really in it.
Yes, solution is using getResourceAsStream instread of getResource. getResourceAsStream - works well.
Thanks