I am trying to read a file from an external jar using java .. For example, I have two jar files. One of them is "foo.jar", the other is "bar.jar". Inside the "bar.jar" is the file "foo-bar.txt". How can I read the file "foo-bar.txt" from inside "bar.jar" using the code in "foo.jar" ...? Is it even possible ..? I know that I can read the file from iside foo.jar using
this.getClass().getClassLoader().getResourceAsStream("foo-bar.txt");
But I do not know how to do this from an external can. Can someone help me?
source share