Resource Loading API

  • A file in the current working director could be read using new File(fileName).

  • A file in the in the class path (inside the jar or war or next to classes), could be read using the various getResourceAsStream(fileName) methods of the Class, ContextClassLoader, or the default ClassLoader.

  • A file in inside a web applications, context.getResourceAsStream(fileName).

In the framework, that is pretty easy, just call

InputStream in=JKResourceLoaderFactory.getResourceLoader().getResourceAsStream(name);

or even easier:

InputStream in=JKIOUtil.getInputStream(fileName)