="/u5927/u5bb6/u597d"
再运行结果如下:
"
大家好" (2)另一种解决办法:
2010-09-10 15:23:14 标签:name find Can base bundle
Can't find bundle for base name
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将 追究法律责任。stones.blog.51cto/621580/389939
Struts2国际化异常处理
这是找不到指定文件; 你必须把 .properties 文件,放在与这个调用文件.java 相同的目录里; Hello.java在workspace\test\src\com\lj\guojiehua下 hello_en_US.properties必须在workspace\test\src下 hello_zh_CN.properties必须在workspace\test\src下
其实原因是我虽然在
build path 里面 加了\pruway\source\source\config, 但是系统编译的时候, 在classes里面应该会自动产生resource_en_US.properties,可是实际情况是classes包下面 没有产生,故我删掉重加,再编译结果发现通过了。 。
就是说,只要你buildpath路径对了,该路径下也有resoucebudle需要的类,那么
系统会自动 在classes里面自动编译产生这些类的。所以,先检查classes里,有没有生成对应的 resource_en_US.properties,如果没有, 那么检查build path 路径下有没有对应的properties类, 如果有, 那么证明系统编译没有编译完整, 删掉path, 重新add foler, 加入, 再编译, 检查classes 下有无。 如果都有,那么证明成功。
10.java.lang.IllegalThreadStateException 解决办法:不能启动两次线程 答:必须有一个public static void main(String[] args){//这里是入口}作为入口点, 启动java虚拟机时虚拟机会找这个方法,如果没有就报exception in thread
“main”java.lang.nosuchmethoderror
baidu/
原始出错程序是这样的: 解答方式:import java.net.InetAddress ; public class a{ public static void main(String args[]) throws Exception {// 所有异常抛 出 InetAddress locAdd = null ; InetAddress remAdd = null ; locAdd = InetAddress.getLocalHost() ;// 得到本机 remAdd = InetAddress.getByName("baidu/") ; System.out.println("本机的IP地址:" + locAdd.getHostAddress()) ; System.out.println("MLDNJAVA 的 IP 地 址 : " + remAdd.getHostAddress()) ; System.out.println("本机是否可达:" + locAdd.isReachable(5000)) ; } //5000代表代数 };
运行后结果为:
如果注释掉remAdd = InetAddress.getByName("baidu/") ; 运行结果又是这样的:
上述程序的解决办法是:将
remAdd = InetAddress.getByName("baidu/") ;改成
程序运行结果如下:
完成实验要求,但是这里就有一个
问题了,为什么去掉http//和后面的/的就运行的 了呢?
(2)但是对于这个极其相似的程序却 可以运行出结果:
import java.net.InetAddress ; public class b { public static void main(String args[])throws Exception{ InetAddress address=InetAddress.getByName("microsoft"); System.out.println("ip: "+address.getHostAddress()); System.out.println("host: "+address.getHostName()); System.out.println("canonical "+address.getCanonicalHostName()); byte[] bytes=address.getAddress(); for(byte b:bytes) { if(b>=0)System.out.print(b); else System.out.print(256+b); } } host name:
}
运行结果为:
13.运行下列程序出现了这样的错误,这是线程的知 识,一个线程如果启动了,再启动一个的时候就会报错: java.lang.IllegalThreadStateException
程序如下:class thrund extends Thread{ private String name; public thrund(String name){ this.name=name; } public void run(){ //线程完成的动作 for(int j=0;j<4;j++){ System.out.println(name+"第"+j+"个"); } } }; public class a { public static void mai