11 2011 档案
摘要:1. console模式下: String fileDir = Thread.currentThread().getContextClassLoader().getResource("./").getPath(); 或者 = PropertiesFacoty.class.getClassLoader().getResource("./").getPath(); 或 URL fileDir = PropertiesFacoty.class.getResource("."); 在web容器中直接获取到系统的lib目录而不是项目的。2. w
阅读全文
摘要:转自:http://blog.csdn.net/ruyanhai/archive/2007/11/07/1871663.aspx◆一般情况下,我们都使用相对路径来获取资源,这样的灵活性比较大.比如当前类为com/bbebfe/Test.class而图像资源比如sample.gif应该放置在com/bbebfe/sample.gif而如果这些图像资源放置在icons目录下,则应该是com/bbebfe/icons/sample.gif通过当前类文件的路径获取资源主要有如下几种方式:· 假设当前类为com.bbebfe.Test· 包所在的文件夹为binString image
阅读全文

浙公网安备 33010602011771号