• Post Reply Bookmark Topic Watch Topic
  • New Topic

Read Properties File Located In Jar File From A JSP Page  RSS feed

 
James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a properties file "application.properties" that sets up environment specific information.

In the staging environment, this properties file is located in a JAR file under WEB-INF/lib/somejar.jar. In the production environment, the properties file is located under WEB-INF/classes/application.properties.

Two questions:
1) Within the staging environment - can I read the application.properties file from a JSP if it is located in a JAR file?
2) If so, will I be able to look it up using the same code in production (since the application.properties file is no longer jarred up)?


PS - Due to red tape - I can't change the structure of either environment.

Any help appreciated.

Thanks,
Jim
 
Venkat Sadasivam
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. You can use same code. Jar and classes directory are in classpath hence you can use ClassLoader.getResourceAsStream(:String) method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!