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. css3 - [CSS] 動畫效果 3D翻轉bug2. python - Django分頁和查詢參數的問題3. javascript - 百度echarts series數據更新問題4. MySQL客戶端吃掉了SQL注解?5. javascript - JS設置Video視頻對象的currentTime時出現了問題,IE,Edge,火狐,都可以設置,反而chrom卻...6. php自學從哪里開始?7. python小白的基礎問題 關于while循環的嵌套8. 求大神幫我看看是哪里寫錯了 感謝細心解答9. phpstady在win10上運行10. javascript - 圖片能在網站顯示,但控制臺仍舊報錯403 (Forbidden)
