• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading a properties file

 
Ananth Ram
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • 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
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic