Hi, I need to read a resource file from classpath in my BlackBerry application. The directory structure of my project is pretty common: under src directory there are 2 child dirs, one represents source packages root, another - resources root.
When I try to read any resource from classpath Class.getResourceAsStream method retures null
InputStream rStream = null;
String path = "/res/default_config.xml";
try {
rStream = getClass().getResourceAsStream(path);
} finally {
try {
if (rStream != null) {
byte[] data = IOUtilities.streamToBytes(rStream);
System.out.println(new String(data));
rStream.close();
}
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
How should I read classpath resource properly?