• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

properties file

 
chandra t
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i am writing a servlet which access a database using properties file.the error is it is not able to find the properties file.
so could u please tell me where should i keep the properties file
iam using jbuilder.
when i gave completepath like c:\..\...it is giving error null pointer exception.
 
Robert Brunner
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by chandra t:
hi
i am writing a servlet which access a database using properties file.the error is it is not able to find the properties file.
so could u please tell me where should i keep the properties file
iam using jbuilder.
when i gave completepath like c:\..\...it is giving error null pointer exception.


Why don't you set the property inside the Servlet (using the System.setProperty method)? A better technique is to use a datasource.
As far as the specifics, I am afraid they are a bit servlet specific. You might try putting the properties file in the same directory as the servlet class file, but then this might pose a security risk.
 
chandra t
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u robert.
i got that.we can place property file any where and we can give the complete path.
and if we want to put the property file anywhere we have to set the path in classpath and can access the prperty file using System.getProperty
cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic