[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform] Re: How to reference a file packaged in a plugin
|
The way is to use InputStreams and
this.getClass().getResourceAsStream("filename relative to the package of
the class doing getResourceAsStream")
or
this.getClass().getResourceAsStream("/filename relative to root of jar")
The difference between the two above is the leading slash ('/'). Without
the leading slash the file is relative to the package the class is
located in, with the slash, it is relative to the root of the jar instead.
File(loc) doesn't work on files within a jar. It only works on files in
the file system.
--
Thanks,
Rich Kulp