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;
	}
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 ; }
当 words.dic 是从 jar 里加载时, 可能 defalut 不存在