What\'s the difference between:
InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName)
and
InputSt
Use MyClass.class.getClassLoader().getResourceAsStream(path)
to load resource associated with your code. Use MyClass.class.getResourceAsStream(path)
as a shortcut, and for resources packaged within your class' package.
Use Thread.currentThread().getContextClassLoader().getResourceAsStream(path)
to get resources that are part of client code, not tightly bounds to the calling code. You should be careful with this as the thread context class loader could be pointing at anything.