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

Unable to access Property file

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

where i can keep the property file and access it?


I've answered that twice already.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If I am not wrong.. the locale should en-US, not en_US.


Actually, you are wrong.
 
reply
    Bookmark Topic Watch Topic
  • New Topic