Java启动openoffice服务后拒绝连接
世界只因有你
世界只因有你 2017-07-03 11:43:16
[Java讨论组]

手动启动是没有问题的,但是如果我用代码启动服务后,报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)\\OpenOffice4\\program\\startOpenoffice.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)\OpenOffice4\program
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

世界只因有你
世界只因有你

全部回复(1)
漂亮男人

报错信息发出来

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号