Java .class.getResourceAsStream()
inputstream, jar, java
Solution
Nope, the getResourceAsStream() method gets a file from the classpath. That includes anything that is specified like this on the command line (windows version, linux uses ':' as delimiter):
java -cp "path;path2;path3;path4/some.jar" your.main.Clazz
Problem
To the best of my knowledge, `Class.getResourceAsStream()` gets an `InputStream` directed at a file within the .jar file? If I'm wrong about this, please correct me. Is there any way to temporarily 'load' an external file into the .jar, so that the `getResourceAsStream()` method can retrieve it? For example loading `C:/folder/file.txt` into the .jar so that `MyClass.class .getResourceAsStream("file.txt")` would return a working `InputStream` to the file, or at least a copy of it that has been 'loaded' temporarily into the .jar. I'm sorry I've worded this so badly, I hope you can understand what I'm trying to do, wasn't quite sure how to explain it simply.