ResourceBundle

I'm having trouble with ResourceBundle on a Windows Platform.
For Instance I have:
URL=ResourceBundle:mypath\\file.properties:URL
I want to use:
URL=ResourceBundle:C:Projects\\file.properties:URL
How do I escape the colon after the C, but yet have java still see it as part of a directory search structure?
Tried:
tableColor=ResourceBundle:\Projects/cfl_online/osp/cfl.properties:tableColor
tableColor=ResourceBundle:/Projects/cfl_online/osp/cfl.properties:tableColor
tableColor=ResourceBundle:Projects/cfl_online/osp/cfl.properties:tableColor
tableColor=ResourceBundle:\\Projects\\cfl_online\\osp\\cfl.properties:tableColor
tableColor=ResourceBundle:\Projects\cfl_online\osp\cfl.properties:tableColor
tableColor=ResourceBundle:C\:\\Projects\\cfl_online\\osp\\cfl.properties:tableColor
tableColor=ResourceBundle:C\:/Projects/cfl_online/osp/cfl.properties:tableColor
Any help appreciated, thank you again!

Your ultimate aim is to access a value in a property file using ResourceBundle,I think the right way to use ResourceBundle is
ResourceBundle res=ResourceBundle.getBundle("myresource");
res.getString("url");
Do try the above step.
NOTE: Do not mention "myresource.properties" inside getBundle().

Similar Messages

  • Error-java.util.ResourceBundle.throwMissingResourceException

    hi all,
    im implementing a report for reporting empty filder..
    i got an error while running the report in portal.
    i got this error..
    unexpected error accessing report com.sap.km.reporting.SimpleReport@641ffc: java.util.MissingResourceException: Can't find bundle for base name com.sap.km.reporting.SimpleReport, locale en_IE
                at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:839)
                at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:729)
                at java.util.ResourceBundle.getBundle(ResourceBundle.java:579)
                at com.sap.km.reporting.SimpleReport.getDisplayName(SimpleReport.java:68)
                at com.sapportals.wcm.repository.manager.reporting.monitor.ReportComponent$ReportWrapper.getDisplayName(ReportComponent.java:294)
                at com.sapportals.wcm.repository.manager.reporting.types.RPReportHandler$DisplayNameGen.getProperty(RPReportHandler.java:160)
                at com.sapportals.wcm.repository.manager.reporting.types.RPPropHandler.getProperties(RPPropHandler.java:110)
                at com.sapportals.wcm.repository.manager.reporting.types.RPPropHandler.getProperties(RPPropHandler.java:143)
                at com.sapportals.wcm.repository.manager.reporting.RPPropertyManager.getProperties(RPPropertyManager.java:89)
                at com.sapportals.wcm.repository.ResourceImpl.internalGetProperties(ResourceImpl.java:3699)
                at com.sapportals.wcm.repository.ResourceImpl.internalGetPropertiesExtended(ResourceImpl.java:1343)
                at com.sapportals.wcm.repository.ResourceImpl.getProperties(ResourceImpl.java:1308)
                at com.sapportals.wcm.repository.CollectionImpl.getChildren(CollectionImpl.java:383)
                at com.sapportals.wcm.service.resourcelistfilter.cm.ResourceListFilter.getChildren(ResourceListFilter.java:425)
                at com.sapportals.wcm.rendering.collection.cm.InternalTree.getChildren(InternalTree.java:1868)
                at com.sapportals.wcm.rendering.collection.cm.InternalTree.getFirstCallOpenResources(InternalTree.java:1142)
                at com.sapportals.wcm.rendering.collection.cm.InternalTree.getFirstCallOpenResources(InternalTree.java:1172)
                at com.sapportals.wcm.rendering.collection.cm.InternalTree.buildNewTree(InternalTree.java:704)
                at com.sapportals.wcm.rendering.collection.cm.InternalTree.renderTree(InternalTree.java:852)
                at com.sapportals.wcm.rendering.collection.cm.InternalTree.render(InternalTree.java:546)
                at com.sapportals.wcm.rendering.collection.cm.InternalTree.buildContent(InternalTree.java:2295)
                at com.sapportals.wcm.control.util.components.base.BaseCompositeComponent.buildComposition(BaseCompositeComponent.java:196)
                at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
                at com.sapportals.htmlb.Container.preRender(Container.java:118)
                at com.sapportals.htmlb.Container.preRender(Container.java:118)
                at com.sapportals.htmlb.Container.preRender(Container.java:118)
                at com.sapportals.htmlb.Container.preRender(Container.java:118)
                at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:34)
                at com.sapportals.htmlb.Container.preRender(Container.java:118)
                at com.sapportals.htmlb.Container.preRender(Container.java:118)
                at com.sapportals.htmlb.Container.preRender(Container.java:118)
                at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:413)
                at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:237)
                at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:130)
                at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:129)
                at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
                at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:73)
                at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
                at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
                at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
                at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
                at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
                at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
                at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
                at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
                at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
                at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
                at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
                at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
                at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
                at java.security.AccessController.doPrivileged(Native Method)
                at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
                at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
                at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
                at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
                at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
                at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
                at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
                at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
                at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
                at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
                at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
                at java.security.AccessController.doPrivileged(Native Method)
                at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
                at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
    could anyone provide me a solution for this..
    Regards,
    Vinoth

    See Error -Can't find bundle ,locale en_US

  • ADF Groovy Expression with bind variable and ResourceBundle

    Now I have ViewObject which have WHERE clause with bind variable.
    This bind variable is for language. Within bind variable I can change Value Type to Expression and into Value: I put +(ResourceBundle.getBundle("model.ModelBundle")).getString("language")+.
    Now if I run Oracle Business Component Browser (on AppModule) this works. In my ModelBundle.properties there is language=1 name-value pair. And with different locale I have different language number.
    Now if I put that ViewObject on one JSF, this bind variable expression does not work any more. Error:
    *oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.util.MissingResourceException, msg=Can't find bundle for base name model.ModelBundle, locale my_locale*
    Any ideas?
    10x
    Zmeda

    The most wierd thing is that, if I make ViewObjectImpl and insert this method
    public String getLanguage() {
    return (ResourceBundle.getBundle("model.ModelBundle")).getString("language");
    and call it in Bind Variable Expression Value: viewObject.getLanguage()
    IT WORKS!
    But why with groovy expression it does not work?
    Zmeda

  • How can I define "java.util.ResourceBundle" in my Code ?

    Dear Mr. MLRon,
    Thanks to you for your replying to me.
    How can I define "java.util.ResourceBundle" in my Code ? To more understanding about my problem I can say that the Persian Font is Like as Arabic, but the Java can not Recognize it. please tell me how can I add "java.util.ResourceBundle" to my code and what should I do then?
    Thank you in advance,
    Tantan.

    Please stop starting new threads for this. Please reply in the original thread!
    http://forum.java.sun.com/thread.jspa?threadID=627917

  • Java.util.ResourceBundle VS java.util.Properties

    I want to keep some key values pair outside program in a properties file and use that in my program. There is no requirement of localization. Should i use ResourceBundle or Properties class? Previously I have used Properties class for this purpose but in my current project ResourceBundle is being used. Is there any benefits in using ResourceBundle? will it be faster to read properties using ResourceBundle?

    ResourceBundles support internationalization. If you know that don't need it and Properties suffice, okay then.
    Forget about "fast", both will have to read from the disk (slow) and both will use hashmaps (fast look-up). And both will probably do it in the same way.

  • How to realize czech texts with ResourceBundles

    Hi!
    I have got a big problem trying to make one of our german applications available in czech.
    We are using ResourceBundles with .properties files for our texts and have now translated them into czech. When loading the bundle by calling:
    ResourceBundle rb = ResourceBundle.getBundle("x.x.x.BundleName", locale);all seems to work and there is no exception thrown.
    But when i try to get any text out of it i.e. by calling:
    rb.getString("name");i get an exception:
    java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key name
    I tryied to use native2ascii with several encodings (Cp1252, ISO-8859-1, ISO-8859-2, UTF-8, UTF-16, ...) but i never got one that realy works the way i want. Most of the encodings i tryied changes some of the special characters in the file but also left some of them so that i can get some translated texts but most of them with boxes or question symbols within. native2ascii with UTF-8 encoding only answers with a sun.io.MalformedInputException in the comand line. UTF-16 initially looked fine cause nearly all special characters was translated into \uXXXX escape sequences but also there i got a problem with one special character: � (hope it will be displayed correctly here). This character seems to annoy the native2ascii tool cause the following characters would also be translated into escape sequences even if this is not necessary. Also i got some question symbols in the GUI again (having the charset in the HTML/JSP file set to UTF-16).
    I don't know why the original translated property file could not be read in getting an exception only when trying to get a text not when loading the file. Another thing confusing me is that all encodings (except UTF-16) that i tryied for the translated file corrupted the file by seperating each character with a blank one (so i.e. name = jm�no appered as n a m e = j m \u00e9 n o).
    Some of the special characters in the translation are: � � � � � (and also some other characters with those symbols).
    Please can anyone help me or does anyone has experiences with translating a (web) project to czech or any similar/related language.
    Thanks a lot
    Juergen

    You also seem to have a problem with using native2ascii. You say that you tried to use it with Cp1252, ISO-8859-1 (among others), but how can you possibly have a Czech file in those code pages? They don't support the Czech characters set. You simply need to know which source code page your file is actually in, and then run native2ascii on the file specifying that encoding. I have never had a problem executing native2ascii on a Czech file, it seems to work just fine - as long as the correct source encoding is used.

  • Multiple ResourceBundle definitions with the same name

    I created a new web application project with JSF support using Netbeans 5.5Beta. The new project has a simple welcomeJSF page that I did not modify. The only modifications I did is adding a CustomMessages.properties file under com.mywebsite.resourcs and adding the following entry to faces-config.xml:
    <application>
            <resource-bundle>
                <base-name>com.mywebsite.resources.CustomMessages</base-name>
                <var>BundleOne</var>
            </resource-bundle>
            <locale-config>
                <default-locale>en</default-locale>
            </locale-config>
        </application>Now when I right click welcomeJSF and select Run File, the follow error is added to the log file of SJSAS PE9:
    Message ID:
    WebModule[/WebApplication1]Exception sending context initialized event to listener instance of class com.sun.faces.config.GlassFishConfigureListener javax.faces.FacesException
    Complete Message
    Can't parse configuration file: jndi:/server/WebApplication1/WEB-INF/faces-config.xml: Error at line 14 column 27: Error at (14, 27: Multiple ResourceBundle definitions with the same name: BundleOne.
         at com.sun.faces.config.ConfigureListener.parse(ConfigureListener.java:1751)
         at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:524)
         at com.sun.faces.config.GlassFishConfigureListener.contextInitialized(GlassFishConfigureListener.java:47)
         at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
         at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:833)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:817)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:659)
         at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1468)
         at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1133)
         at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:171)
         at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:275)
         at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:954)
         at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:941)
         at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:448)
         at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
         at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:296)
         at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:203)
         at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285)
         at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119)
         at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:541)
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:585)
         at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:719)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353)
         at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336)
         at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448)
         at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
         at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
         at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
         at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77)
         at $Proxy1.invoke(Unknown Source)
         at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
         at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:56)
         at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:142)
         at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:109)
         at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:180)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

    Go ahead and doubt if it makes you feel superior.
    For others:
    If your pom has this:
    <dependency>
                   <groupId>javax.faces</groupId>
                   <artifactId>jsf-api</artifactId>
                   <version>${jsf.version}</version>
              </dependency>
              <dependency>
                   <groupId>javax.faces</groupId>
                   <artifactId>jsf-impl</artifactId>
                   <version>${jsf.version}</version>
              </dependency>
    where jsf.version = 1.2, change jsf.version to 1.2_10

  • How to "get object" -- ResourceBundle

    According to the ResourceBundle API:
    ResourceBundle myResources =  ResourceBundle.getBundle("MyResources");Besides getString, ResourceBundle also provides ... a generic getObject method for any other type of object. When using getObject, you'll have to cast the result to the appropriate type. For example:
    int[] myIntegers = (int[]) myResources.getObject("intList");
    {code}
    Elsewhere,
    +getBundle+ attempts to locate a property resource file.
    Does it make sense/Is it possible to +getObject+ from a property resource file? If so, how is the object "expressed" in the property resource file?
    For example, if the resource file looks like
    1=Person
    then the key 1 is associated with the String "Person"
    If
    [code]class Person {
    String firstName;
    String lastName;
    ... }[/code]
    is it possible to associate "1" with a Person object, where firstName is "Foo" and lastName is "Bar"?
    If so, how would it look in the property resource file?
    Thanks in advance,
    C                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    In the resource file, you can save the data like this:
    numberofperson=2
    firstname1=Foo
    firstname2=dummyfirst
    lastname1=Bar
    lastname2=dummylast
    For programming, you can code like this:
    public class Person{
    private String firstname;
    private String lastname;
    public Person(String firstname, String lastname){
    this.firstname = firstname;
    this.lastname = lastname;
    int personNum = Integer.parseInt(myResources.getString("numberofperson"));
    Person personArr[] = new Person[personNum];
    for (int i=1; i<personNum; i++){
    personArr[i] = new Person(myResources.getString("firstname"+i),myResources.getString("lastname"+i));
    }

  • Can't get ResourceBundle from jar.

    Dear all,
    I have problem in geting properties from file included in jar file. I try to do it by calling mthod ResourceBundle.getBundle("bundle"), where bundle.properies is the file in jar. When I run the programm by calling :
    java -jar dist/properties.jar
    I have the following rsult on the console:
    Exception in thread "main" java.util.MissingResourceException: Can't find bundle
    for base name bundle, locale pl_PL
    at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:712)
    at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:683)
    at java.util.ResourceBundle.getBundle(ResourceBundle.java:546)
    In case I run this program, using not jar'ed classes everything is ok.
    P.S. the manifest file of the jar is:
    Manifest-Version: 1.0
    Created-By: Apache Ant 1.5.1
    Main-Class: PropertiesLoader
    Thanks in advance for all answers.
    Daniel Kwieci&#324;&#347;ki

    According to ResourceBundleAPI:
    Calling this method is equivalent to calling
        getBundle(baseName, locale, this.getClass().getClassLoader()),
    except that getClassLoader() is run with the security privileges of ResourceBundleTry this code, it will obtain the application's ClassLoader and will enable the location of the properties file in all the classpath defined for it.
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
            resources = ResourceBundle.getBundle(BUNDLE_BASENAME, locale, loader);Good Luck!

  • Problem with ResourceBundle in Jar

    Hi,
    I've written the following class which works perfectly in my program but not when used in the same code but distributed as a Jar file.
    In this case, only the default locale is used on a "Messages.getString" call, even if I swith the local to English...
    I've read that there was a "bug" in the j2sdk1.4.2_05 and I'm using the j2sdk1.4.2_06.
    Do you have any idea ?
    Thanks,
    Marc.
    package com.oxiane.marketing.IHM;
    import java.util.Locale;
    import java.util.MissingResourceException;
    import java.util.ResourceBundle;
    * Classe servant � g�rer les langues Anglaise et Fran�aise pour
    * l'interface.
    public class Messages {
         private static final String BUNDLE_NAME = "Messages" ;
         private static ResourceBundle RES_BUNDLE_FR = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault());
         private static ResourceBundle RES_BUNDLE_EN = ResourceBundle.getBundle(BUNDLE_NAME, Locale.ENGLISH);
            public static String getString(String msg){
                 try {
                      if (Locale.getDefault().getLanguage() == "fr")
                           return RES_BUNDLE_FR.getString(msg);
                      else
                           return RES_BUNDLE_EN.getString(msg);
                 catch (MissingResourceException e){
                      System.out.println(e.getMessage());
                      return "";
         public static void setLocale(Locale loc){
              Locale.setDefault(loc);
         public static Locale getLocale(){
              return Locale.getDefault();
    }

    You should take care of the directory structure according to the package structure.
    I for example have this jar:
    C:\source\java\ebank2_util\smsunlock>unzip -l pro-ebank_sms_unlock.jar
    Archive:  pro-ebank_sms_unlock.jar
    Length    Date    Time    Name
          0  10-28-05  17:27   hu/
          0  10-28-05  17:27   hu/khb/
          0  10-28-05  18:17   hu/khb/smsunlock/
        256  11-07-05  16:33   hu/khb/smsunlock/DButils$MySQLException.class
       4229  11-07-05  16:33   hu/khb/smsunlock/DButils.class
       1700  11-07-05  16:33   hu/khb/smsunlock/GUI$1.class
       2318  11-07-05  16:33   hu/khb/smsunlock/GUI$2.class
        988  11-07-05  16:33   hu/khb/smsunlock/GUI$3.class
       1402  11-07-05  16:33   hu/khb/smsunlock/GUI$mywl.class
       5630  11-07-05  16:33   hu/khb/smsunlock/GUI.class
        818  11-07-05  16:33   hu/khb/smsunlock/LimitedLength_TextField.class
       2452  11-07-05  16:33   hu/khb/smsunlock/Main.class
        900  11-07-05  16:33   hu/khb/smsunlock/MyInputStream.class
          0  11-07-05  16:33   META-INF/
         98  10-27-05  15:53   META-INF/manifest.mf
         90  11-07-05  16:33   hu/khb/smsunlock/properties
      20881                    16 filesAnd the resource is loaded like this from hu.khb.smsu.Main:
    InputStream is = new MyInputStream( Main.class.getResourceAsStream( "properties" ) );

  • Error in Async - Sync "Localization failed: ResourceBundle"

    Hello Experts,
    I have a scenario in which im receiving an idoc, transforming it into an XML and sending to a webservices through SOAP channel. The response from the webservices is transformed into a RFC BAPI and sent back to R/3
    This is the error i am receiving. I have no clue what this means :S
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="MAPPING">JCO_SYSTEM_FAILURE</SAP:Code>
      <SAP:P1><--Localization failed: ResourceBundle='com.sap.engine.services.rfcengine.RFCRes</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>&quot;SYSTEM FAILURE&quot; during JCo call. &lt;--Localization failed: ResourceBundle='com.sap.engine.services.rfcengine.RFCRes</SAP:Stack>
      <SAP:Retry>N</SAP:Retry>
      </SAP:Error>
    Looking forward for your suggestion!

    Are you using BPM for this scenario?
    Regards,
    Prateek

  • How to create SAP RAR file using NWDS 7.31: ResourceBundle issue

    Hello everybody,
    I successfully create SAP JCA Connector project for .java / .class files.
    When I try to use ResourceBundle in connector project, it isn't exported to JAR / RAR / EAR files.
    What should I do?
    The only builders are:
    * org.eclipse.jdt.core.javabuilder
    * org.eclipse.wst.common.project.facet.core.builder
    * org.eclipse.wst.validation.validationbuilder
    When I try to export connector project to SAP RAR file, I can switch between binary-only or binary with sources, not any checkbox for *.properties.
    Thank you in advance for any point.

    Here patching info.
    Source getting script:
    echo off
    set JN=com.sap.ide.j2ee.servicelayer_1.0.1.140801063136.jar
    set JAR=C:\NWDSsp12.p3\plugins\%JN%
    set FERN=C:\sap\fernflower.jar
    set UNZIP="C:\Program Files\7-Zip\7z.exe"
    java -jar %FERN% %JAR%  .
    mkdir src\com\sap\ide\j2ee\servicelayer\archive
    %UNZIP% x %JN% com\sap\ide\j2ee\servicelayer\archive\BuildRar*java
    move com\sap\ide\j2ee\servicelayer\archive\BuildRar*java src\com\sap\ide\j2ee\servicelayer\archive\
    rmdir /s/q com
    echo **************************************************************************
    echo *                                                                        *
    echo *                                                                        *
    echo *                                                                        *
    echo * Now fix BuildRar.createArchiveDescriptorForProjectWithPattern() method *
    echo * look for "if(sAddJavaFiles)" condition                                *
    echo *                                                                        *
    echo * if (sAddJavaFiles)                            =: if (true)            *
    echo * IPattern javaPattern = Pattern.getPattern(2); =: .getPattern(3)        *
    echo *                                                                        *
    echo **************************************************************************
    pause
    Classpath file:
    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.equinox.common_3.5.1.R35x_v20090807-1100.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.jobs_3.4.100.v20090429-1800.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.resources_3.5.2.R35x_v20091203-1235.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_3.5.0.v20090525.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.servicelayer_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ext.ra_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.extensionpoints_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.util_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.web_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.tssap.util.core_2.0.0.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.tssap.util.trace_1.0.0.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.tssap.tools_2.0.0.140801063136/lib/com.tssap.tools_api.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.core_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.eclipse.jarsap_2.0.0.140801063136/lib/com.sap.ide.eclipse.jarsap_api.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ear_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.client_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ejb_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ext.client_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ext.cmpejb_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ext.core_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ext.ear_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ext.ejb_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ext.web_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.adapter.ra_1.0.1.140801063136.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.sap.ide.j2ee.ui_1.0.1.140801073130.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.tssap.util.sdk.ui_2.0.0.140801063136/lib/com.tssap.util.sdk.ui_api.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.core_3.5.2.v_981_R35x.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jst.j2ee_1.1.302.v201004131604.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jem.workbench_2.0.201.v200911302230.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jem.util_2.0.201.v201001252130.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ui.workbench_3.5.2.M20100113-0800.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jst.j2ee.core_1.1.301.v200911302230.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jface_3.5.2.M20100120-0800.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ltk.core.refactoring_3.5.0.v20090513-2000.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.wst.common.modulecore_1.1.301.v201001252130.jar"/>
    <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.wst.common.project.facet.core_1.4.1.v200911141735.jar"/>
    <classpathentry kind="output" path="bin"/>
    </classpath>
    Patching:
    @echo off
    set JN=com.sap.ide.j2ee.servicelayer_1.0.1.140801063136.jar
    set JAR=C:\NWDSsp12.p3\plugins\%JN%
    set ZIP="C:\Program Files\7-Zip\7z.exe"
    set BLD=bin\com\sap\ide\j2ee\servicelayer\archive
    copy/b %JAR% .
    cd bin && %ZIP% a ..\%JN% com\sap\ide\j2ee\servicelayer\archive\*class
    echo **************************************************************************
    echo * Now replace:
    echo * %JAR%
    echo * with with .\%JN%
    echo **************************************************************************
    pause
    Attached: some scripts and project files.
    Also see NWDS_PatchRAR at google disc.

  • Problem for ResourceBundle calling from jsp file

    Hi, I am using WebLogic 5.1 in Solaris 8
              I use java.util.resourceBundle to get the information from a .properties
              file
              I put the properties file in /opt/weblogic/myserver/serverclasses
              When I call the properties file from EJB, It seems to be OK
              But when I call the properties file from JSP using the same script, It said
              the properties files not found
              The Error message is:
              <ServletContext-General> Servlet fail
              ed with Exception
              java.util.MissingResourceException: Can't find bundle for base name
              test.dbini,
              locale zh_TW
              at
              java.util.ResourceBundle.throwMissingResourceException(ResourceBundle
              .java:707)
              at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:679)
              at java.util.ResourceBundle.getBundle(ResourceBundle.java:546)
              at
              jsp_servlet._test._global_95_variable._jspService(_global_95_variable
              .java:85)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:105)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:123)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
              textImpl.java:742)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
              textImpl.java:686)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
              ContextManager.java:247)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
              a:361)
              at
              weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              PLease Help!!
              Regards,
              Fannie
              

    Hi,
    open dataset file for input in text mode.
    check sy-subrc = 0.
    while sy-subrc = 0.
      read dataset file into wa.
      if sy-subrc = 0.
      append wa to itab.
      else.
        exit.
      endif.
    endwhile.
    close dataset file.
    regards
    Siggi
    PS: check also the F1-help for open, read and close statements!

  • Can ResourceBundle load .properties from files and .jar?

    Hi Guys,
    I'm trying to I18N an application with ResourceBundle.
    Suppose my class look like this:
    package pack;
    import java.util.ResourceBundle;
    public class MyClass {
        public static void main(String[] args) {
            ResourceBundle rb = ResourceBundle.getBundle("Language");
    }This would load the localized string from Language.properties
    And when I pack the class file and Language.properties into a jar. It works fine
    But what I tried to do is to make the ResourceBundle try to load from external file first
    before it load from the jar file so that if I have a new language file I can just drop in the
    NewLang.properties.
    Inside .jar file look like this
    /Language.properties
    /pack/MyClass.class
    /meta-inf/Manifest.mf
    I tried look into some forum and they suggest to include Class-Path in Manifest.mf file
    to include current path like this
    Class-Path: .
    But still, it didn't work. If I include .properties in .jar it will not look outside but if I didn't include
    any .properties it found a properties file.
    How can I achieve this ?

    Dave,
    I reckon you're on the right track... just have to figure out "what's the path to properties file"... I suspect you've got a context problem... not sure... I'm pretty new at this stuff myself.
    So, what's your development environment? O/S, IDE, app/web-server, etc.
    Cheers. Keith.

  • Problem using Regex with ResourceBundle

    Hi,
    i'm using a ResourceBundle to store I18N strings in various languages. Now when I try to use those as patterns in a Regex, it just doesn't match.
    Here is a sample string:
    Mode lecture : S�curis� SANS C2, Flux pr�cis, Cache d�sactiv�
    In the ResourceBundle it looks like this, encoded as Unicode codepoints:
    eaclog.1254=S\u201acuris\u201a SANS C2, Flux pr\u201acis, Cache d\u201asactiv\u201a
    When I retrieve the regex pattern (myPattern.pattern()), it looks like this on the console:
    S�curis� SANS C2, Flux pr�cis, Cache d�sactiv�
    It seems like the encoding in the regex isn't right. What have I done wrong?

    Cool, thanks for the reply. The character encoding was broken even before I converted it using natice2ascii, now it works!
    From now on, I will always use the "-reverse" option to see if the output looks right. Boy, and I thought it was some weird regex problem...

  • ResourceBundle problem with IE7

    Hi all,
    I have problems getting the correct ResourceBundle from the Locale in my applet using IE7. It works with Firefox2 (and with IE6 as a user told me, I did not test this though). Can anyone help me with this? Below you see relevant code and the output in Firefox and IE7:
      System.out.println("DisplayLanguage: "+currentLocale.getDisplayLanguage());
        res_bundle = ResourceBundle.getBundle("myResources.ApplicationResources", currentLocale);
        System.out.println("Locale in ResourceBundle: "+res_bundle.getLocale().toString());
        System.out.println("DisplayLanguage in ResourceBundle: "+res_bundle.getLocale().getDisplayLanguage());
    Output in Firefox 2:
    DisplayLanguage: Italienisch
    Locale in ResourceBundle: it //correct
    DisplayLanguage in ResourceBundle: Italienisch
    Output in InternetExplorer 7:
    DisplayLanguage: it_it //different from the Firefox output
    Locale in ResourceBundle: de //incorrect, this is the default Locale
    DisplayLanguage in ResourceBundle: Deutsch

    Ok, this is apparently a JSP issue. The Language Code provided by request.getLocale() in the JSP is not the same for every browser:
    in Firefox: de, it (this is what the Locale constructor needs: the ISO-639 language code)
    in IE7, Safari: de_DE, it_IT
    I don't know why this is the case, but now I can use a workaround (i.e. ignore the second part of the language code).
    So, the problem is solved. However, I would be still interested in the reasons for these differences...
    Thanks, Gonzberg

Maybe you are looking for

  • Inner class reflection

    Hello ! I have the following class (excerpt): public final class Patient      public Patient()           //...some code here      public PatientFilter Filter = new PatientFilter();      public final class PatientFilter           public String Pkey =

  • HT1688 i took my phone to get replaced under the warranty but i didnt get the charger or the headphones was i supposed to?

    My phone's power button was stuck and had to take it in to get it replaced under the warranty, but i didnt get a charger for it or the headphones that come with the new phone, was i supposed to get something?

  • Program Won't Start Up

    a few days ago i went to start a program from my dock and accidently hit my limewire program, which i didn't want to start. the icon began to bounce so i right clicked on it and hit 'force quit'. the program didn't start so i thought everything was o

  • Waves AU crashes Logic 7 when quiting or opening sessions

    Hello, I have this crash every time that I close a session in Logic and try to open another one. The crash report says in their first 8 threads logs about Waves. The first one reads: 1 com.Waves.AU.plugin.shell 0x30f6e60c CallPlugin_DeleteInstance(Pl

  • When opening my session, my computer shuts down

    Good morning; I have had this problem for two hours now and I am very worried. When I turn on my computer, everything goes well, I click on my session icon, type my password, and the computer starts loading it. However, it goes very slowly, and every