Java by API/java.util/MissingResourceException
catch MissingResourceException
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class MainClass {
public static void main(String args[]) throws Exception {
ResourceBundle resources;
try {
resources = ResourceBundle.getBundle("MyData");
System.out.println(resources.getString("Hi"));
} catch (MissingResourceException mre) {
System.err.println("MyData.properties not found");
}
}
}
//File: MyData.properties
/*
Hi = Hello World!
*/
//File: MyData_fr.properties
/*
Hi = Salut tout le monde!
*/