java.net.ConnectException: connection failed: socket,host=127.0.0.1,port=8100,tcpNoDelay=1:
在做word转换的时候,使用代码
String command = OpenOffice_HOME
+ "OpenOffice\program\soffice.exe -headless -accept=\"socket,host=127.0.0.1,port=8100;urp;\" -nofirststartwizard";
System.out.println(command);
Process pro = Runtime.getRuntime().exec(command);
// 端口号8100 --链接
OpenOfficeConnection connection = new SocketOpenOfficeConnection("127.0.0.1", 8100);
connection.connect();
// convert
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(docFile, pdfFile);
// close the connection
connection.disconnect();
转换文档的时候,连接失败,我在另一台电脑上启动项目后,可以正常转换,怎么解决这个错误。