欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

获得jar中数据,获得jar数据,// example c

来源: javaer 分享于  点击 47793 次 点评:275

获得jar中数据,获得jar数据,// example c


// example code of access data using getResource()     public static File getDefalutPath() {          if(defalutPath == null) {               String defPath = System.getProperty("mmseg.dic.path");               log.info("look up in mmseg.dic.path="+defPath);               if(defPath == null) {                    URL url = Dictionary.class.getClassLoader().getResource("data");                    if(url != null) {                         defPath = url.getFile();                         log.info("look up in classpath="+defPath);                    } else {                         defPath = System.getProperty("user.dir")+"/data";                         log.info("look up in user.dir="+defPath);                    }               }               defalutPath = new File(defPath);               if(!defalutPath.exists()) {                    log.warning("defalut dic path="+defalutPath+" not exist");               }          }          return defalutPath;     }
相关栏目:

用户点评