• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to access Property file

 
V Patil
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to access property file using Resource Bundle.
But i am getting an error Can't find bundle for base name Resources/Properties, locale en_US
this error is when i kept the Resources folder parallel to WEBCONTENT and SRC folder.(in Resouces folder Properties.properties file is present).
when i keep the properties file inside SRC folder it is accessible using
ResourceBundle rb = ResourceBundle.getBundle("Resources/Properties",Locale.getDefault());
I am using Eclipse.

Please help.
Thanks in advance
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resources are loaded using a class loading mechanism, so they need to be in the classpath. Eclipse may add additional folders to the classpath that normally aren't part of it.
 
pats Patil
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the solution for this problem?
when properties file is kept inside src folder it is accessible.
Please help.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"pats Patil", are you somehow related to "Vikas Patil"? If so, let us know which account you'd like to keep so that we can close the other.

when properties file is kept inside src folder it is accessible.

No. Resources are loaded from the classpath, and the source folder should not be part of it.
 
pats Patil
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
both accounts belong to me.
you can close the one named Vikas Patil.
So what is the solution for this?
when i am trying to access the Properties.properties file kept parallel to SRC and WEBCONTENT i am getting an error Can't find bundle for base name Resources/Properties, locale en_US ???
else where i can keep the property file and access it?
please help?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where i can keep the property file and access it?

I've answered that twice already.
 
Om Tejas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I am not wrong.. the locale should en-US, not en_US. I am not sure if this effecting your functionality.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I am not wrong.. the locale should en-US, not en_US.

Actually, you are wrong.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic