• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Reading a properties file

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

I have created a properties file under the root of my project. I would like to read the file to retrieve some config values. Could some one point out the path to determine the file.

I am able to read the file when I place the file under WEB-INF/classes/test.properties with the below code.



Thanks in advance for your help. It is a JSP / Struts application.

Ananth Ram
 
Sheriff
Posts: 28323
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ananth Ram wrote:I am able to read the file when I place the file under WEB-INF/classes/test.properties with the below code.




Good. And that's exactly what you should be doing. So it works? Then what is your question? You mentioned a "project", which isn't a technical term in either JSP or Struts as far as I know.
 
Ananth Ram
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I meant the web project.

Root--> test.properties, file included.
Root --> src is the folder where my struts action package and other java code resides.
Root --> web is the folder where the jsp, css/images,etc resides.

I want to place the file under the root folder and read the same. Please let me know if I am not clear.

Thanks,
Ananth Ram


 
Ananth Ram
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,

I will have the properties file copied to the WEB-INF/classes folder using ANT script like other cfg files.

Ananth Ram
 
Paul Clapham
Sheriff
Posts: 28323
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see. So this "project" is in some kind of IDE then? In that case this is a question about that IDE... whatever it is. Is there a reason you aren't telling us that? At any rate let me move this post to the IDEs forum.

By the way I have found that artifacts under the "src" folder get compiled into artifacts under the WEB-INF/classes folder in my IDE environment. Yours might work the same way.
 
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic