Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » access file within plug-in?
access file within plug-in? [message #335754] Mon, 27 April 2009 15:07 Go to next message
Matt Anderson is currently offline Matt AndersonFriend
Messages: 6
Registered: July 2009
Junior Member
Hello,

I have a plug-in that currently accesses a configurable, but runtime
static XML file. I would like to move the file from the directory where
it is stored and zip it up with the plugin itself. Is there a way for a
plug-in at runtime to access files within its plugin? Maybe something in
the plugin.xml that would make the file visible to the code?

Just wondering,

Thanks,

Matt A
Re: access file within plug-in? [message #335755 is a reply to message #335754] Mon, 27 April 2009 15:28 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

The easiest way is to make sure it is in your classpath (i.e. you put it
into your source folder for the plugin) and then just use standard java
access:

URL url = SomeClassInYourPlugin.getResource("/path to resource");

or

InputStream is = SomeClassInYourPlugin.getResourceAsStream("/path to
resource");

where SomeClassInYourPlugin is some class in your plugin.

Matt Anderson wrote:
> Hello,
>
> I have a plug-in that currently accesses a configurable, but runtime
> static XML file. I would like to move the file from the directory where
> it is stored and zip it up with the plugin itself. Is there a way for a
> plug-in at runtime to access files within its plugin? Maybe something
> in the plugin.xml that would make the file visible to the code?
>
> Just wondering,
>
> Thanks,
>
> Matt A
>

--
Thanks,
Rich Kulp
Previous Topic:Update Navigator IResource-Children progrmatically
Next Topic:p2 metadata generator doesn't complete
Goto Forum:
  


Current Time: Fri Apr 26 15:36:58 GMT 2024

Powered by FUDForum. Page generated in 0.03193 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top