Classpath questions [message #198494] |
Mon, 14 March 2005 14:53  |
Eclipse User |
|
|
|
I'm developing an editor plugin. Inorder to edit a file using my editor,
the user is expected to create a Java Project. Under this project, the
user can created a file with my specific extension. The test configuration
i'm using is as follows:
1. I have a Java Project. It's build path has the following entries:
a. the source directory
b. the default JRE
c. An additional "Class Folder". This folder will not contain any
classes, but instead project related resources such as XML files. I called
this folder Config. This folder could also be linked to any external
folder.
During execution plugin may need to read XML files by file name (specified
by the user) and the plugin assumes that these files reside in the Config
folder, or any other folder in the classpath.
Intuitively, the Project's build path is not the same as a plugin's
runtime classpath, right. So, how can i get the Project Builder's
Classloader (IF such a classloader does exist) from inside my plugin so
that i can locate the required resource, which is in the Config folder in
the project's build path?
i'm trying to do something similar to this inorder to find the XML file:
Get Java builder classloader.
InputStream stream = classloader.getResourceAsStream("/"+configFileName);
Any help is greatly appreciated. I'm totally new to JDT plugin components.
Sapna George
|
|
|
Re: Classpath questions [message #198615 is a reply to message #198494] |
Tue, 15 March 2005 11:57  |
Eclipse User |
|
|
|
Use Bundle#getEntry(String) to get an URL representing the file. You can
then use an URLInputStream to read the file.
Cheers
Tobias
"Sapna George" <sgeorge@vt.edu> wrote in message
news:d14q3d$9id$1@www.eclipse.org...
> I'm developing an editor plugin. Inorder to edit a file using my editor,
> the user is expected to create a Java Project. Under this project, the
> user can created a file with my specific extension. The test configuration
> i'm using is as follows:
> 1. I have a Java Project. It's build path has the following entries: a.
> the source directory
> b. the default JRE
> c. An additional "Class Folder". This folder will not contain any classes,
> but instead project related resources such as XML files. I called this
> folder Config. This folder could also be linked to any external folder.
> During execution plugin may need to read XML files by file name (specified
> by the user) and the plugin assumes that these files reside in the Config
> folder, or any other folder in the classpath.
> Intuitively, the Project's build path is not the same as a plugin's
> runtime classpath, right. So, how can i get the Project Builder's
> Classloader (IF such a classloader does exist) from inside my plugin so
> that i can locate the required resource, which is in the Config folder in
> the project's build path?
> i'm trying to do something similar to this inorder to find the XML file:
>
> Get Java builder classloader.
> InputStream stream = classloader.getResourceAsStream("/"+configFileName);
>
> Any help is greatly appreciated. I'm totally new to JDT plugin components.
> Sapna George
>
|
|
|
Powered by
FUDForum. Page generated in 0.03167 seconds