relative path in jar file
Hi there.
I have created a plugin and placed the content in a jar file.
The structure is like this:
com/intellij/openapi/modification/
META-INF/plugin.xml
resources/icons/<*.png>]]>
My question is how do i get the icons image files using the relative path. I have tried loading them using the path "resources/icons/icon.png" but it doen't work.
I know this is more a Java question but can anybody give me a hint? For what i have found so far i think i should use the ClassLoaded.getResource() method but i still can't make it work.
Raul
请先登录再写评论。
.getClass().getResource("/resources/icons/<*.png>") or .class.getResource("/resources/icons/<*.png>]]>")
Chris Sherratt wrote:
That isn't cool, a subclass might have been loaded with a different
classloader.
This is better.
Thanks guys.
I tried both of them and they work.
Can you just explain why is the second one better?