file io - Issue when trying to use getResourceAsStream in java -


so have 2 lines in code follows:

inputstream = this.getclass().getclassloader().getresourceasstream("resources/config"); bufferedreader bufferedreader = new bufferedreader(new inputstreamreader(is)); 

and file structure in eclipse follows (image posted):

enter image description here

when try run code, nullpointerexceptions when reaches second line (bufferedreader line). can't life of me figure out why inputstream "is" becoming null. ideas?

when using classloader load stream, path using absolute path (so should not use leading / in case) , should start root package. in case under src.

so since resource under package qbooksprintfix/resources should access like:

getresourceasstream("qbooksprintfix/resources/config")


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -