try {
/**
* 创建iplist.txt文件记录ip
*/
File file = new File(ContentMethod.pathOfTomcat
+ "/webapps/shareResource/iplist.txt");
if (!file.exists())
if (!file.createNewFile())
throw new Exception("文件不存在,创建失败!");
} catch (Exception e) {
System.out.println(e.getMessage());
}
/**
* 将主服务器的ip写入iplist.txt中
*/
try {
File file = new File(ContentMethod.pathOfTomcat
+ "/webapps/shareResource/iplist.txt");
FileWriter filewriter = new FileWriter(file, true);
filewriter.write(host);
filewriter.close();
} catch (IOException e) {
throw e;
} catch (Exception ex) {
throw ex;
}