public void TomcatShutdownEnvironment(String path) throws Exception{
String TomcatAdds="path";
InputStreamReader isr = new InputStreamReader(new
FileInputStream(path+TomcatAdds+"\\bin\\shutdown.bat"));
BufferedReader br = new BufferedReader(new
InputStreamReader(new FileInputStream(path+TomcatAdds+"\\bin\\shutdown.bat")));
String data = null;
data = br.readLine();
br.close();
isr.close();
if(data.equals("@echo off")){
StringBuffer input=new StringBuffer();
input.append("set path="+path.substring(1)+TomcatAdds+"\\jdk\n");
input.append("set classpath="+path.substring(1)+TomcatAdds+"\\jdk\\bin\n");
input.append("set JAVA_HOME="+path.substring(1)+TomcatAdds+"\\jdk\n");
input.append("set CATALINA_HOME="+path.substring(1)+TomcatAdds+"\n");
File file=new File(path.substring(1)+TomcatAdds+"\\bin\\shutdown.bat");
System.out.println(path.substring(1)+TomcatAdds+"\\bin/shutdown.bat");
insertStringInFile(file,1,input.toString());
System.out.println("tomcat modify");
}else{
System.out.println("tomcat has been ready");
}
}
String TomcatAdds="path";
InputStreamReader isr = new InputStreamReader(new
FileInputStream(path+TomcatAdds+"\\bin\\shutdown.bat"));
BufferedReader br = new BufferedReader(new
InputStreamReader(new FileInputStream(path+TomcatAdds+"\\bin\\shutdown.bat")));
String data = null;
data = br.readLine();
br.close();
isr.close();
if(data.equals("@echo off")){
StringBuffer input=new StringBuffer();
input.append("set path="+path.substring(1)+TomcatAdds+"\\jdk\n");
input.append("set classpath="+path.substring(1)+TomcatAdds+"\\jdk\\bin\n");
input.append("set JAVA_HOME="+path.substring(1)+TomcatAdds+"\\jdk\n");
input.append("set CATALINA_HOME="+path.substring(1)+TomcatAdds+"\n");
File file=new File(path.substring(1)+TomcatAdds+"\\bin\\shutdown.bat");
System.out.println(path.substring(1)+TomcatAdds+"\\bin/shutdown.bat");
insertStringInFile(file,1,input.toString());
System.out.println("tomcat modify");
}else{
System.out.println("tomcat has been ready");
}
}