This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Problem with class.getResourceAsStream

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic