Meenal Mishra
Meenal Mishra

Reputation: 49

When I am fetching the values from property file using ResourceBundle,I get an exception

ResourceBundle bundle = ResourceBundle.getBundle("abc");
ipAddress = bundle.getString("ipAddress");

I get the following exception:

java.util.MissingResourceException: Can't find resource for bundle 
java.util.PropertyResourceBundle, key ipAddress

Upvotes: 0

Views: 439

Answers (1)

Ryan Stewart
Ryan Stewart

Reputation: 128829

Your call to getBundle() will load a properties file named according to the strategy described in the javadoc. The simplest case would be to simply load it from a file named "abc.properties". What the error is telling you is that whichever properties file is being selected, it doesn't contain a key named "ipAddress". I.e., there should be, but isn't, a line like this in the file:

ipAddress=1.2.3.4

Upvotes: 1

Related Questions