• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Read Properties File Located In Jar File From A JSP Page

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic