如果使用这种方式加载加载资源文件
FileInputStream fis = new FileInputStream( PropertiesUtil.class.getClassLoader().getResource("config/config.properties") .getPath());
生成的jar文件运行的时候,会报找不到properties文件,这时会使用这种方式加载资源文件。
InputStream in = PropertiesUtil.class.getClassLoader().getResourceAsStream("config/config.properties") ;`
生成jar文件的运行方式为在cmd下运行java -jar test.jar