How to read a file from the JAR?

Someone just asked me this question today. And I thought might as well put it down for info. ''' public TestReadFileFromJar() throws FileNotFoundException, IOException { InputStream is = getClass().getResource(“txtData/states.properties”); read(is); } ''' In the case above txtData is placed in the jar on the root. Remmember to add the path with the “/”

October 31, 2008 · 1 min · Theme PaperMod