开发者

Java web application context

I have a J开发者_Go百科ava web application. Inside the WAR I have a folder containing configuration files for the application. I need to know the path of the folder in order to load the files at runtime.

I also need the solution to work in Tomcat and in WebSphere.

Thanks.


I would suggest placing the files under WEB-INF/classes and simplying loading them from the classpath, not from the filesystem. This way, the path is always the same.

You can use something like:

InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("path");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜