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. javascript - electron中的a标签怎么用浏览器直接打开而不是在框架窗体内2. 前端 - 谁来解释下这两个 CSS selector 区别3. 为啥获取不到呀?4. mysql每隔10来秒就有一次7、8MB的写入5. html5 - 最近在自学react 求一个react表单提交的例子6. javascript - 怎么实现让 div 里面的 img 元素 中心居中, 如下示例图7. window下mysql中文乱码怎么解决??8. javascript - vscode alt+shift+f 格式化js代码,通不过eslint的代码风格检查怎么办。。。9. html5 - bootstrap修改样式的问题10. javascript - ie11以下单击打开不了file,双击可以。求解?
