• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

creating java class resource bundle  RSS feed

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the OCP Book by Jeanne Boyarsky and Scott Selikoff, the following code is given as an example of class resource bunde :

however, when I run it here is what I get :

Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Tax, locale en_US

.
Does anyone know what I miss
 
Sheriff
Posts: 23714
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was your class "Taxt_en_US" meant to be the resource bundle for "Tax"? The spelling of that name explains why it can't be found.
 
yas sine
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeep, the class Tax_en_US is meant to be the resource bundle, however, I don't see what is wrong with the class name, In the book it is said that it must have this form : "ClassName_Language_Country" ..., Am I wrong ??
 
Paul Clapham
Sheriff
Posts: 23714
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

yas sine wrote:yeep, the class Tax_en_US is meant to be the resource bundle, however, I don't see what is wrong with the class name



You didn't call the class "Tax_en_US". Look again at what you did call it.
 
yas sine
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ohh yeah, I made a mistake, however, I still get the same error :


Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Tax, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:845)
at Chap5.Tax_en_US.main(Taxt_en_US.java:17)


here is the class code :
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!