j2ee 中 获取windows或者linux配置文档路径

String os = System.getProperty("os.name");
			URL syspath = LawsIndex.class.getClassLoader().getResource("");
			String path = syspath.toString();
			path = path.replace("+", " ");
			path = path.replace("%20", " ");
			if (os.startsWith("Windows")) {
				path = path.substring(6, path.length());
			}
			InputStream is = new FileInputStream(path+"word.dic");

你可能感兴趣的:(java,windows,linux,OS)