membersound
membersound

Reputation: 86925

How to use properties file in webserver?

I have a JavaSE application that makes use of a .properties file that is at the root of classpath.

I'm trying to convert this tool to a webserver app, which already runs fine, but the properties file is not found.

How can I make sure that this file gets copied from classpath to the webserver? How do I have to change the path of that file new FileInputStream("file.propteries") accordingly?

Upvotes: 0

Views: 251

Answers (1)

Nick Holt
Nick Holt

Reputation: 34321

You should include your properties file in the WEB-INF/classes directory of your war file and then use ClassLoader.getResourceAsStream(String) passing the name of the properties file.

Upvotes: 2

Related Questions