Can't find bundle for base name

转自:https://blog.51cto.com/stones/389939

Struts2国际化异常处理

这是找不到指定文件;

你必须把 .properties 文件,放在与这个调用文件.java 相同的目录里;

Hello.java在workspace estsrccomljguojiehua下

hello_en_US.properties必须在workspace estsrc下

hello_zh_CN.properties必须在workspace estsrc下


其实原因是我虽然在build path 里面 加了pruwaysourcesourceconfig,但是系统编译的时候,在classes里面应该会自动产生resource_en_US.properties,可是实际情况是classes包下面没有产生,故我删掉重加,再编译结果发现通过了。。

就是说,只要你buildpath路径对了,该路径下也有resoucebudle需要的类,那么系统会自动在classes里面自动编译产生这些类的。所以,先检查classes里,有没有生成对应的resource_en_US.properties,如果没有,那么检查build path 路径下有没有对应的properties类,如果有,那么证明系统编译没有编译完整,删掉path,重新add foler,加入,再编译,检查classes下有无。
如果都有,那么证明成功。


原文地址:https://www.cnblogs.com/sharpest/p/14951045.html