public void DeleteIndex(String id) {
try {
FileWriter fw = new FileWriter("C:\\exampledocs\\delete.bat");
fw.write("cd C:\\exampledocs");
fw.write("\r\n");
fw.write("c:");
fw.write("\r\n");
fw.write("java -Ddata=args -Durl=http://localhost:8080/solr/update -jar post.jar " + "\"<delete><query><id>" +id+ "</id></query></delete>\"");
fw.write("\r\n");
fw.write("del delete.bat");
fw.write("\r\n");
fw.write("exit");
fw.close();
Process process = Runtime.getRuntime().exec("cmd.exe /C start C:\\exampledocs\\delete.bat");
BufferedReader read = new BufferedReader(new InputStreamReader(process.getInputStream()));
String str = null;
while ((str = read.readLine()) != null) {
System.out.println(str);
}
}
catch (Exception e1) {
e1.printStackTrace();
}
}
当运行的时候
D:\workspace\SolrJ>cd C:\exampledocs
D:\workspace\SolrJ>c:
C:\exampledocs>java -Ddata=args -Durl=http://localhost:8080/solr/update -jar pos
SimplePostTool: version 1.2
SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, othe
SimplePostTool: POSTing args to http://localhost:8080/solr/update..
SimplePostTool: COMMITting Solr index changes..
C:\exampledocs>del delete.bat
找不到批处理文件。
C:\exampledocs>
文件其实也删除了 不过给我报了这个错 下面的exit都没有执行,结果框框还在
谁能告诉我 为什么啊
我不把del delete.bat写在代码中
当执行到
D:\workspace\SolrJ>cd C:\exampledocs
D:\workspace\SolrJ>c:
C:\exampledocs>java -Ddata=args -Durl=http://localhost:8080/solr/update -jar pos
SimplePostTool: version 1.2
SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, othe
SimplePostTool: POSTing args to http://localhost:8080/solr/update..
SimplePostTool: COMMITting Solr index changes..
C:\exampledocs>
这的时候
我手动的去写 del delete.bat就可以直接执行 为什么
try {
FileWriter fw = new FileWriter("C:\\exampledocs\\delete.bat");
fw.write("cd C:\\exampledocs");
fw.write("\r\n");
fw.write("c:");
fw.write("\r\n");
fw.write("java -Ddata=args -Durl=http://localhost:8080/solr/update -jar post.jar " + "\"<delete><query><id>" +id+ "</id></query></delete>\"");
fw.write("\r\n");
fw.write("del delete.bat");
fw.write("\r\n");
fw.write("exit");
fw.close();
Process process = Runtime.getRuntime().exec("cmd.exe /C start C:\\exampledocs\\delete.bat");
BufferedReader read = new BufferedReader(new InputStreamReader(process.getInputStream()));
String str = null;
while ((str = read.readLine()) != null) {
System.out.println(str);
}
}
catch (Exception e1) {
e1.printStackTrace();
}
}
当运行的时候
D:\workspace\SolrJ>cd C:\exampledocs
D:\workspace\SolrJ>c:
C:\exampledocs>java -Ddata=args -Durl=http://localhost:8080/solr/update -jar pos
SimplePostTool: version 1.2
SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, othe
SimplePostTool: POSTing args to http://localhost:8080/solr/update..
SimplePostTool: COMMITting Solr index changes..
C:\exampledocs>del delete.bat
找不到批处理文件。
C:\exampledocs>
文件其实也删除了 不过给我报了这个错 下面的exit都没有执行,结果框框还在
谁能告诉我 为什么啊
我不把del delete.bat写在代码中
当执行到
D:\workspace\SolrJ>cd C:\exampledocs
D:\workspace\SolrJ>c:
C:\exampledocs>java -Ddata=args -Durl=http://localhost:8080/solr/update -jar pos
SimplePostTool: version 1.2
SimplePostTool: WARNING: Make sure your XML documents are encoded in UTF-8, othe
SimplePostTool: POSTing args to http://localhost:8080/solr/update..
SimplePostTool: COMMITting Solr index changes..
C:\exampledocs>
这的时候
我手动的去写 del delete.bat就可以直接执行 为什么