private static Properties properties = new Properties();
private static String path = System.getProperty("user.dir").replace("\\", "/") + "/avenuebus.properties";
public static void getIP(){
FileInputStream s = null;try {
System.out.println(path);
s = new FileInputStream(new File(path));
properties.load(s);
IP = properties.getProperty("avenuebus.IP");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (s != null) {
s.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
avenuebus.properties配置文件名称
avenueBus.IP=168.0.0.1//配置IP