ResourceBundles --- MissingResourceException
Posted: Sun Apr 23, 2023 3:24 am
Can you please assist
My code is giving MissingResourceException
package com.mycompany.localize
ResourceB.java
Bundle.properties
In ResourceB.java
Text in Bundles.properties
wish=Happy Birthday
What I tried already
1. Using / as file separator
2. Appending .properties on Bundle
3. localize.Bundles or localize.Bundle.properties as resource
4.Creating a resource folder com.mycompany.localize.resources
My code is giving MissingResourceException
package com.mycompany.localize
ResourceB.java
Bundle.properties
In ResourceB.java
Code: Select all
public class ResourceB {
public static void main(String[] args) {
String lang ="en";
String country ="US"
Locale loc = new Locale(lang,country);
ResourceBundle rb = ResourceBundle.getBundle("com.mycompany.localize.Bundle", loc);
System.out.println(rb.getString("wish"));
}
}
wish=Happy Birthday
What I tried already
1. Using / as file separator
2. Appending .properties on Bundle
3. localize.Bundles or localize.Bundle.properties as resource
4.Creating a resource folder com.mycompany.localize.resources