i want to read a txt file from jar file
im using the following code
the file "level01.txt" is in the jar file - checked via zip
and was placed in a subfolder called "res"
the jarfile was created using jbuilder 5
my problem: my code cant find the file?
error >> java.lang.NullPointerException
ive tried different path/filename versions
does anybody have any idea?
thanks for any help
InputStream is = this.getClass().getResourceAsStream("/level01.txt"
StringBuffer sb = new StringBuffer();
while ((chr = is.read()) != -1)
System.out.println(" > reading OK!"
catch (Exception e)
System.out.println(" > ERROR: Cant Read File ERR= " + e);