473,657 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<Can't find bundle for base name> is driving me mad

Hi all,

Although i'm not a complete newbie i do feel like one at the moment.

This question concerns the use of the ResourceBundle as per the example in
the Trail tutorial on java.sun.com (thus it should be simple, right?).

The error:
java.util.Missi ngResourceExcep tion: Can't find bundle for base name
LabelsBundle, locale en_US
at java.util.Resou rceBundle.throw MissingResource Exception(Unkno wn Source)
at java.util.Resou rceBundle.getBu ndleImpl(Unknow n Source)
at java.util.Resou rceBundle.getBu ndle(Unknown Source)
at multilanguage.P ropertiesDemo.d isplayValue(Pro pertiesDemo.jav a:25)
at multilanguage.P ropertiesDemo.m ain(PropertiesD emo.java:46)

Attached is the code and the three prop files i (try to) use.

I know about the classpath suggestions that can be found all over the place
but the prop files are just sitting nicely in the same dir where the
PropertiesDemo. class file resides (and is started from). This suggests to
me that the classpath is ok (right?).

Should not matter but i'm using Eclipse 3M7.

If anybody could help me out here i would really appreciate it. It is
already bugging me for more than 4 hours now :-[[

TIA
Fermin DCG

package multilanguage;

/*
* Copyright (c) 1995-1998 Sun Microsystems, Inc. All Rights Reserved.
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for NON-COMMERCIAL purposes and without
* fee is hereby granted provided that this copyright notice
* appears in all copies. Please refer to the file "copyright.html "
* for further important copyright and licensing information.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
* THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY , FITNESS FOR A
* PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
*/

import java.util.*;

public class PropertiesDemo {

static void displayValue(Lo cale currentLocale, String key) {
ResourceBundle labels = ResourceBundle. getBundle("Labe lsBundle"/*, currentLocale*/);

String value = labels.getStrin g(key);
System.out.prin tln("Locale = " + currentLocale.t oString() + ", " + "key = " + key + ", " + "value = " + value);
} // displayValue

static void iterateKeys(Loc ale currentLocale) {
ResourceBundle labels = ResourceBundle. getBundle("Labe lsBundle", currentLocale);
Enumeration bundleKeys = labels.getKeys( );
while (bundleKeys.has MoreElements()) {
String key = (String) bundleKeys.next Element();
String value = labels.getStrin g(key);
System.out.prin tln("key = " + key + ", " + "value = " + value);
}
} // iterateKeys

public static void main(String[] args) {
//Locale.setDefau lt(new Locale("en_US") );
Locale[] supportedLocale s = {Locale.FRENCH, Locale.GERMAN, Locale.ENGLISH} ;

for (int i = 0; i < supportedLocale s.length; i++) {
displayValue(su pportedLocales[i], "s2");
}

System.out.prin tln();
iterateKeys(sup portedLocales[0]);
} // main

} // class

#s1 comment
s1=computer

#Comment s2
s2=Platte

#Comment s3
s3=Monitor

#Comment keyboard
s4=Tastatur
#s1 comment
s1=computer

#Comment s2
s2=disk

#Comment s3
s3=monitor

#Comment keyboard
s4=keyboard
#s1 comment
s1=fr_computer

#Comment s2
s2=fr_disk

#Comment s3
s3=fr_monitor

#Comment keyboard
s4=fr_keyboard
#s1 comment
s1=computer

#Comment s2
s2=disk

#Comment s3
s3=monitor

#Comment keyboard
s4=keyboard
Jul 17 '05 #1
0 15237

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
9206
by: Weston C | last post by:
I'm trying to get the href attribute from the base tag in the document head. The following does not seem to work... any ideas what I'm doing wrong? if(!(document.getElementsByTagName) || !(basehrefs = document.getElementsByTagName('base')) || !(basehrefs.length) || !(basehrefs.length > 0) || !(basehrefs.getAttribute) || !(basehref = basehrefs.getAttribute('href')) )
3
1859
by: Christopher | last post by:
I came across this line in a lib I am studing, it simply has class cSceneNode; all by itself. what is that line doing? I am used to seeing a declaration: MyClass test; or definition: class MyClass{ public: foo();}; but never just: class <name>; Thanx, Christopher
2
1938
by: CD | last post by:
Is this possible: class base; class derived; //:public base vector <base*> bList; vector<derived*> dList; //add some derived class pointer entries to dList;
2
2097
by: Siemel Naran | last post by:
This code fails compile std::auto_ptr<Base> f() { std::auto_ptr<Derived> out(new Derived()); return out; } There is ambiguity between a templated constructor and templated operator conversion, according to my compiler. Seems there are too many constructors and operator conversions. But this code works:
3
1622
by: Gilbert Saint-Flour | last post by:
Hello: I have this one line of PHP code which I'd like to convert to Javascript. The PHP code conditionally issues a BASE statement when the html page is called with a frame name, e.g. href=index2.php?frame2 <html> <head> <? $tag = $_SERVER; if(empty($tag)) {; } else { echo "<base target=$tag>"; } ?> </head>
3
4581
by: SJ | last post by:
Hi, I have a problem with the HTML <base> element, URL re-writing and Postback. We are using URL re-writing on the server, and I'd like to use the base element to make the URLs in the ASPX pages more maintainable. Otherwise, we have to manually output the application root eg. src="<%= AppRoot %>". This is cumbersome and hard to maintain. However, there seems to be no way - apart from a client-side script - to rewrite the action...
3
2885
by: noreponse1 | last post by:
Hello, I have a solution that contains two projects. I have 2 dlls that these projects use. Here's how it's set up: Solution -ProjectA --References ---DLLA -ProjectB
1
2250
by: MAILTONRK | last post by:
Hi, I am a Mainframe guy. I am working with MS access(maintaining a application) for the last 2 weeks. I had one master database and four replicas. One of my replica had trouble in synchronization(It said, database is in use..). After searching google, I ran "Compact and repair" utlity against my replica. It looks like, it has changed the attribute of my replica.
3
12847
by: yan | last post by:
Hello everybody, I am new so this is the occasion to say hello to everybody. I have a problem with absolute/relative paths. I have to create a static documentation in html for a project and I have to create an index page in every sub-directory. The structure is like the following: / /sources/ /docs/ /docs/doc1 /share
16
2394
by: call_me_anything | last post by:
why is the following not allowed : vector <Base *vec_of_base; vector <Derived *vec_of_derived; vec_of_base = vec_of_derived; Note : The following is allowed :
0
8403
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.