• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with class.getResourceAsStream  RSS feed

Anastasia Sirotenko
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to load an xsl file with classLoader, but Test.class.getResourceAsStream("test.xsl") always returns null. Then i copied the test.xsl file to test.png - and that one works fine. Can anyone explain me how it can happen?

Here is the test case: two identical files with different extensions reside in the same package, and classloader works with different results:

The output is:
xsl: null
png: java.io.BufferedInputStream@3d84ec44

UPD: The problem found - i was lounching this from IDEA and it was misconfigured: Resource patterns setting included *png but didn't include *xsl
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!