|Absolute path of file in bundle classpath [message #529379]
||Sat, 24 April 2010 06:20
| Kai Schlamp
Registered: July 2009
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 ");
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
Powered by FUDForum
. Page generated in 0.05146 seconds