R
R
Hi All,
I have a question. I have one global properties file the {root}/res
level directory (root = default package level directory).
I have also classes like:
- mypackages.text.Parser (package: mypackages.text),
- mypackages.db.mysql.DBManager (package: mypackages.db.mysql),
- and programs in 'programs' package.
I want all classes independently of package (subpackage) level will use
my global.properties
when I do something like this:
InputStream is =
mt.getClass().getResourceAsStream("res/global.properties");
in i.e. programs package it will look of course for a file:
programs/res/global.properties
in mypackages.db.mysql file mypackages/db/mysql/res/global.properties
but I want to load "global" properties from the most top level
directory.
I can of course do something like ../../res/global.properties - but
it's not flexible at all
if I move my class to sup/sub package I will have to modify it all
and BTW how can I get OutputStream associated with class (something
like getResourceAsStream() )?
thanks in advance for your help
best regards
R
I have a question. I have one global properties file the {root}/res
level directory (root = default package level directory).
I have also classes like:
- mypackages.text.Parser (package: mypackages.text),
- mypackages.db.mysql.DBManager (package: mypackages.db.mysql),
- and programs in 'programs' package.
I want all classes independently of package (subpackage) level will use
my global.properties
when I do something like this:
InputStream is =
mt.getClass().getResourceAsStream("res/global.properties");
in i.e. programs package it will look of course for a file:
programs/res/global.properties
in mypackages.db.mysql file mypackages/db/mysql/res/global.properties
but I want to load "global" properties from the most top level
directory.
I can of course do something like ../../res/global.properties - but
it's not flexible at all
if I move my class to sup/sub package I will have to modify it all
and BTW how can I get OutputStream associated with class (something
like getResourceAsStream() )?
thanks in advance for your help
best regards
R