Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsstore a file in the plugin
https://www.eclipse.org/forums/index.php/mv/msg/86337/267966/#msg_267966
Originally posted by: rm.triadem.ch
Hello
I like store a DTD file in my plugin (similar to a .properties file).
Which is the best way to this, so that the running application has
an easy access to the file?
You can't store in the plugin itself at runtime. However, you are given
a workarea in each workspace per plugin that your plugin can store
files in:
Use Platform.getStateLocation(Bundle) to get a path to this workarea
that your plugin owns.
However if your question is you want to put it in the plugin at
development time so that it is available at runtime, you will need to
either put in your jar (i.e. put it in your source directory) and then
use the standard java class.getResource() to access it or put it in your
project directory and:
1) Update the build.properties bin.includes line to include this new
file or directory
2) Use Platform.find(Bundle, IPath) to get the URL to it and then use
url.openStream() to access the contents of the file.
--
Thanks, Rich Kulp
]]>2004-08-20T14:02:42-00:00Re: store a file in the plugin
https://www.eclipse.org/forums/index.php/mv/msg/86337/268192/#msg_268192
Originally posted by: rm.triadem.ch
Rich Kulp wrote:
> You can't store in the plugin itself at runtime.
Sorry my question was not precise enough.
> However if your question is you want to put it in the plugin at
> development time so that it is available at runtime
That is what I am looking for.
> 1) Update the build.properties bin.includes line to include this new
> file or directory
Done.
> 2) Use Platform.find(Bundle, IPath) to get the URL to it and then use
> url.openStream() to access the contents of the file.