Java啟動openoffice服務后拒絕連接
問題描述
手動啟動是沒有問題的,但是如果我用代碼啟動服務后,報connection refused錯誤
public static String soffice_host = '127.0.0.1';public static String soffice_port = '8100';public static Process pro = null;String commands = 'cmd.exe /C C:Program Files (x86)OpenOffice4programstartOpenoffice.bat';System.out.println(commands);pro = Runtime.getRuntime().exec(commands); connection = new SocketOpenOfficeConnection(soffice_host,Integer.parseInt(soffice_port));System.out.println('獲得連接'+connection);connection.connect();
可以打印出連接connection的內容,但是之后連接的時候報錯
starOpenoffice.bat內容:soffice -headless -accept='socket,host=127.0.0.1,port=8100;urp;' -nofirststartwizard
手動啟動方法:cd C:Program Files (x86)OpenOffice4programsoffice -headless -accept='socket,host=127.0.0.1,port=8100;urp;' -nofirststartwizard
問題解答
回答1:報錯信息發出來
相關文章:
1. 怎么php怎么通過數組顯示sql查詢結果呢,查詢結果有多條,如圖。2. 求大神支招,php怎么操作在一個html文件的<head>標記內添加內容?3. php - 數據庫表如果是null怎么替換為其他字段的值4. mysql - 數據庫建字段,默認值空和empty string有什么區別 1105. 致命錯誤: Class ’appfacadeTest’ not found6. mysql - JAVA怎么實現一個DAO同時實現查詢兩個實體類的結果集7. javascript - mysql插入數據時怎樣避免與庫中的數據重復?8. mysql建表報錯,查手冊看不懂,求解?9. shell - Update query wrong in MySQL10. sql語句 - 如何在mysql中批量添加用戶?
