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. docker安裝后出現Cannot connect to the Docker daemon.2. Docker for Mac 創建的dnsmasq容器連不上/不工作的問題3. android - 七牛單次上傳單張圖片,11次6次上傳失敗4. PC 手機兼容的 編輯器5. java報錯Communications link failure 該如何解決?6. mysql - 用PHPEXCEL將excel文件導入數據庫數據5000+條,本地數據庫正常,線上只導入15條,沒有報錯,哪里的問題?7. css - 關于border-image8. 關于Android權限的獲取問題,大家遇到過這樣的情況嘛?9. android - 項目時間長了,字符串文件strings有的字符串可能是多余的,有沒有辦法快速檢測那些是沒用的?10. javascript - 怎么看網站用了什么技術框架?
