java - Filepath in war -
i created sigleton applicationconfig
settigs, reads xml config file. every time fails on path file.
hierarchy:
meta-inf src --application ----config.xml --engine ----applicationconfig web --web-inf ----web.xml
i've tried file f = new file("../application/config.xml");
gives c:\weblogic\application\config.xml
it's bad idea store configs in 'src'. it's better separate code , configuration. suggest read maven (or gradle). basic maven app has pretty simple structure:
src --main ----java ----resources
where in 'java' folder store code, , in 'resource' folder store configs. , have problem, because jvm trying find file relatively weblogic base folder.
and if use maven, write:
applicationconfig.class.getresourceasstream("/config.xml")
of course, in case should put config 'resources' folder.
Comments
Post a Comment