Reading a file from a jar

The following code works on my Windows machine, but fails on my Linux box:

String line;

try{

BufferedReader br=new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/hss/app/images/mappings.txt")));

while ((line = br.readLine()) !=null){

if (line.indexOf('=') > -1){

String[] s = line.split("[=]");

mappings.put(s[0].trim(), s[1].trim());

}

}

}catch (IOException ex){

ex.printStackTrace();

}

With the following error:

Exception in thread"main" java.lang.ExceptionInInitializerError

at hss.cris3.ImageManager.getInstance(ImageManager.java:43)

at hss.cris3.Application.<init>(Application.java:87)

at hss.app.cris.<init>(cris.java:78)

at hss.app.cris.main(cris.java:1064)

Caused by: java.lang.NullPointerException

at java.io.Reader.<init>(Reader.java:61)

at java.io.InputStreamReader.<init>(InputStreamReader.java:55)

at hss.cris3.ImageManager.<init>(ImageManager.java:26)

at hss.cris3.ImageManager.<init>(ImageManager.java:19)

at hss.cris3.ImageManager$ImageManagerHolder.<clinit>(ImageManager.java:39)

... 4 more

Can anyone explain why? And perhaps more importantly what the solution is? Thanks.

[1870 byte] By [cs02rm0a] at [2007-11-27 7:47:53]
# 1
The return value of getResourceAsStream() seems to be null, which means the resource could not be found. What's your output for the following shell command?jar -tf <yourjarfile>Note: replace <yourjarfile> by the path to your JAR file.
quittea at 2007-7-12 19:28:57 > top of Java-index,Java Essentials,Java Programming...
# 2
Hi I think try to give .........getResourceStream("hssap\\p\\images\\mappings.txt");JOE
JeeDevelopera at 2007-7-12 19:28:57 > top of Java-index,Java Essentials,Java Programming...
# 3

The jar -tf command shows that it's packaging up the folder above too. So the file isn't found because it's at /hss/hss/app/images/mappings.txt

Weird. It's not doing it on Windows, I'm sure I've checked the code out the same way and it's under netbeans in both. Slightly different versions of netbeans though.

cs02rm0a at 2007-7-12 19:28:57 > top of Java-index,Java Essentials,Java Programming...