Friday, February 22, 2008

ResourceBundles in Windows

I was tasked with supporting a new system ( a real pile of junk). I was given URLs to all the environments in which the system runs and was given a demo. So far so good.

I tried downloading on to my local machine, set up my IntelliJ editor, and when i ran my first report (It is a Java based reporting app), i got an error which i have seen a number of times but still could not figure out what it could be..

Error - java.util.MissingResourceException: Can't find bundle for base name com\xxxxx\xx\xxxxxxxxxxxxxxxxx\reportProcessing\ReportProcessing, locale en_US

It is the same code which worked in all the Linux machines and it broke in the following line:
return ResourceBundle.getBundle("com\xxxxxxxxx\xxxx\xxxxxxxxxxxxxxxxx\reportProcessing\ReportProcessing");

The properties file was in the same folder as the class file but it could not pick up.. I tried replacing \ with /, then \ with //. Then removed the package name and just gave the properties file name.. Nothing worked...

Then tried the following line, after reading a lot of forums and it worked...
return ResourceBundle.getBundle("com.xxxx.xx.yyyyyyyyyyy.reportProcessing.ReportProcessing");

Wanted to blog this hack for resourcebundles.

No comments: