> InputStream is =
> mt.getClass().getResourceAsStream("res/global.properties");
[quoted text clipped - 8 lines]
> it's not flexible at all
> if I move my class to sup/sub package I will have to modify it all
getResourceAsStream("/res/global.properties");
^
As explained in the Class API documentation.
> and BTW how can I get OutputStream associated with class (something
> like getResourceAsStream() )?
You can't - assuming you want to write changes back to your
/res/global.properties in some jar.
Instead, set up a per-user properties file, e.g. a hidden file in the
user's home directory and chain the properties lookup:
Properties default = new Properties();
InputStream is =
mt.getClass().getResourceAsStream("/res/global.properties")
default.load(is);
Properties userConfig = new Properties(default);
FileInputStream fis = new ...
userConfig.load(fis);
String ps = userConfig.getProperty("pKey");
//
// When user changes a property only set the property if
// it is different from the default
//
String newPs = ps + somethingElse;
if(!newPs.equals(default.getProperty("pKey")) {
userConfig.setProperty("pKey", newPs);
}
//
// Store (potentially) changed userConfig at some point in time.
//
FileOutputStream fos = new ...
user>config.store(fos, "comment");
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/