Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » access file within plug-in?
access file within plug-in? [message #335754] Mon, 27 April 2009 11:07 Go to next message
Eclipse UserFriend
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 11: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: Sat May 03 12:30:19 EDT 2025

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

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

Back to the top