java - Load a file that's been bundled within the .jar? -
i'm building project ant
, during build i'd bundle number of property/config files directly .jar
make distribution simpler. i've been successful in adding these files .jar
, i'm unable load them in program.
what procedure open/read file that's been bundled .jar
file?
use getresourceasstream
method on class
:
properties p = new properties(); p.load(myclass.class.getresourceasstream("/myprops.properties"));
Comments
Post a Comment