Java啟動(dòng)openoffice服務(wù)后拒絕連接
問(wèn)題描述
手動(dòng)啟動(dòng)是沒(méi)有問(wèn)題的,但是如果我用代碼啟動(dòng)服務(wù)后,報(bào)connection refused錯(cuò)誤
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的內(nèi)容,但是之后連接的時(shí)候報(bào)錯(cuò)
starOpenoffice.bat內(nèi)容:soffice -headless -accept='socket,host=127.0.0.1,port=8100;urp;' -nofirststartwizard
手動(dòng)啟動(dòng)方法:cd C:Program Files (x86)OpenOffice4programsoffice -headless -accept='socket,host=127.0.0.1,port=8100;urp;' -nofirststartwizard
問(wèn)題解答
回答1:報(bào)錯(cuò)信息發(fā)出來(lái)
相關(guān)文章:
1. showpassword里的this 是什么意思?代表哪個(gè)元素2. 對(duì)mysql某個(gè)字段監(jiān)控的功能3. java - Spring MVC怎么實(shí)現(xiàn)提交表單后跳轉(zhuǎn)?4. javascript - windows下如何使用babel,遇到了困惑5. javascript - js中向下取整6. html - vue項(xiàng)目中用到了elementUI問(wèn)題7. JavaScript事件8. javascript - table列過(guò)多,有什么插件可以提供列排序和選擇顯示列的功能9. java - input file類(lèi)型上傳了一個(gè)文件,想計(jì)算一下上傳文件的大???10. python - 為什么正常輸出中文沒(méi)有亂碼,zip函數(shù)之后出現(xiàn)中文編程unicode編碼的問(wèn)題,我是遍歷輸出的啊。
