String repository, projectPath, projectDataBase, projectFileName = textfieldProjectCreate.getText();
projectDataBase = "sqlite:db/" + projectFileName + ".db";
repository = "C:\\Repositories\\" + projectFileName;
try {
BufferedReader in = new BufferedReader(new FileReader(config));
projectPath = in.readLine() + "\\" + projectFileName;
in.close();
//String initCmd2 = "C:\\WINDOWS\\system32\\cmd.exe /c \"" + Init.vsn + "\\trac-admin.bat\" " + projectPath + " initenv " + projectFileName + " " + projectDataBase + " svn " + repository;
String command = "cmd.exe /c trac-admin.bat \"" + projectPath + "\" initenv ";
String[] initCmd = {projectFileName, projectDataBase,"svn",repository};
Runtime runCmd = Runtime.getRuntime();
Process cmdProcess = runCmd.exec(command,initCmd,new File(vsn));
BufferedReader errorProcess = new BufferedReader(new InputStreamReader(cmdProcess.getErrorStream()));
BufferedReader reportProcess = new BufferedReader(new InputStreamReader(cmdProcess.getInputStream()));
String line="",inputLine="",fullLine="";
fullLine += "<!-- PARAMETER -->\n";
fullLine += "COMMANDLINE = " + command + "\n";
for(int i=0; i<initCmd.length;i++) {
fullLine += initCmd[i] + "\n";
}
fullLine += "\n<!-- ERROR: cmdProcess -->\n";
while((line=errorProcess.readLine()) != null) {
fullLine += line + "\n";
}
fullLine += "\n<!-- INFO: cmdProcess -->\n";
while((inputLine=reportProcess.readLine()) != null) {
fullLine += inputLine + "\n";
}
cmdProcess.getErrorStream().close();
cmdProcess.getInputStream().close();
cmdProcess.getOutputStream().close();
BufferedWriter writer = new BufferedWriter(new FileWriter("report.txt"));
writer.write(fullLine);
writer.close();
} catch (IOException e1) {
System.out.println(e1.getMessage());
}
Tomate_Salat: mehrere Shell befehle
Beitrag lesen
mehrere Shell befehle
Tomate_Salat
- java
0 flowh0 Tomate_Salat0 Tomate_Salat0 Markus**0 Tomate_Salat0 Markus**
0 Harlequin