• Post Reply Bookmark Topic Watch Topic
  • New Topic

creating java class resource bundle  RSS feed

 
Ranch Hand
Posts: 36
  • 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: 23513
47
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: 36
  • 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: 23513
47
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: 36
  • 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!