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

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -