• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

where to place .properties file

 
zelynn goay
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. i have one java file that uses .properties file. but it couldn't find the .properties file.
my dir is like this: tomcat/webapps/myapp/WEB-INF/classes/com/example/web/a.class

a.class
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you trying to access the properties file?
 
zelynn goay
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

in my a.class, i have


i place a.properties file at tomcat/webapps/myapp/WEB-INF/classes/com/example/web, but it gives java.
 
Annie Smith
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you try to load files the way you do, it tries to load the file from the 'current directory'. The problem here is that the current directory keeps moving depending on how you start your application, and it's not very useful in a web application anyway.

In web based applications you should keep your properties file inside the application and there are two common ways to do this. You'll find a useful discussion here.

Dave
 
zelynn goay
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. Thanks for the guidelines. Managed to access the .properties file already.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic