前文:
一、读取配置文件方式
1.读取项目内部配置文件
val in: InputStream = this.getClass.getClassLoader.getResourceAsStream("InJar.properties")
val properties = new Properties()
properties.load(in)
2.读取项目外部(系统下)配置文件
val in = new BufferedInputStream(new FileInputStream("\\D:\\Tmp\\OutJar.properties"))
val properties = new Properties()
properties.load(in)
二、Windows和Linux路径区别
Windows:
“/”是表示参数,“\”是表示本地路径。
Linux和Unix:
“/”表示路径,“\”表示转义,“-”和“--”表示参数。
网络:
由于网络使用Unix标准,所以网络路径用“/”。