This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 24088
54
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: 24088
54
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 :
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!