Absolute path of file in bundle classpath [message #529379] |
Sat, 24 April 2010 06:20  |
Eclipse User |
|
|
|
Hello.
I have to write an OSGi bundle/Eclipse plugin where some parts of the code can also be executed in normal Java SDK environment.
The problem is that inside my code are some resources that I need the absolute path to. So I need to fetch that path without the use of OSGi or Eclipse stuff.
This here works fine ... but I need the path, not a stream:
InputStream in = MaxMatcher.class.getClassLoader().getResourceAsStream("configure.xml ");
in.read()
But this fails ... I don't get the real path, just "/configure.xml":
URL url = MaxMatcher.class.getClassLoader().getResource("configure.xml ");
File f = new File(url.toURI()); // already throws an exception here
f.getAbsolutePath());
Any suggestions
Regards,
Kai
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08448 seconds