linux下打包成jar后,,jdbc.properties 和jar在文件夹中同一个位置。
String filePath = System.getProperty("user.dir") + "/jdbc.properties";
InputStream in = new BufferedInputStream(new FileInputStream(filePath));
properties.load(in);
win下在eclipse中时
InputStream is=SourceLoader.class.getClassLoader().getSystemResourceAsStream("jdbc.properties");
properties.load(is);
记录一下。