• 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

loading properties file for a component.

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have created a jar file which is going to use a propeties file.
The jar file is placed in C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\myApplication\WEB-INF\lib

There is a class in the jar which is trying to load the properties file and then access its values.

I have put the properties file in WEB-INF\classes as well as the root of the folder which is later converted to a jar.

How can I load the properties file? I tried different ways like using Thread.currentThread().getContextClassLoader().getResourceAsStream and some other wasy.

Thanks,
Ritesh
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This page from the Tomcat documentation shows two ways:
http://wiki.apache.org/tomcat/HowTo#head-45c3314139cb900ddd43dde2ff671532e6e844bc
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic