Reputation: 1006
How do I reference a file from inside the jar in the packages? Because right now it's only looking for the file in the directory that the jar file is in.
I have packed the file inside of the jar correctly, but I'm not sure how to refer to it.
Upvotes: 0
Views: 169
Reputation: 109613
URL url = getClass().getResource("..../.../...");
InputStream in = getClass().getResourceAsStream("..../.../...");
Either absolute ("/...") or relative to the getClass.
Upvotes: 4