I am writing a project that is packaged as a WAR file and is structured as follows:
MyProject.war
| --- META-INF/
| --- WEB-INF/
|--- classes/ (My compiles project classes)
| |--- com
| |--- package
| |--- MyClass.class
|--- lib/
|--- random.jar
| |--- file1.txt
| |--- file2.txt
|--- MyProject.jar
|--- com
|--- package
|--- MyClass.class
How can I access file1.txt and file2.txt from my MyClass.java file as an input stream?
As long as the JAR containing the resources is in your classpath, you should be able to load them via the context classloader.