Resources Accessing in Java
Friday, March 31, 2006 3:36:02 PM
If you want to access the resource files in an unique form in Java, please do NOT use FileInputStream because it can not work porperly in JAR file.
Instead of FileInputStream, please try the functions below:
//This is passed in my application.
Class.getResourceAsStream ("/some/pkg/resource.properties");
//These two are not tested yet.
ClassLoader.getResourceAsStream ("some/pkg/resource.properties");
ResourceBundle.getBundle ("some.pkg.resource");
Instead of FileInputStream, please try the functions below:
//This is passed in my application.
Class.getResourceAsStream ("/some/pkg/resource.properties");
//These two are not tested yet.
ClassLoader.getResourceAsStream ("some/pkg/resource.properties");
ResourceBundle.getBundle ("some.pkg.resource");






