Tag: soffice

从Java启动OpenOffice服务(soffice)的问题(命令行中的命令,但不是Java)

我想要一个简单的命令,它可以从shell运行,但不能用Java运行。 这是我想要执行的命令,工作正常: soffice -headless “-accept=socket,host=localhost,port=8100;urp;” 这是我试图运行此命令从Java中获取的代码: String[] commands = new String[] {“soffice”,”-headless”,”\”-accept=socket,host=localhost,port=8100;urp;\””}; Process process = Runtime.getRuntime().exec(commands) int code = process.waitFor(); if(code == 0) System.out.println(“Commands executed successfully”); 当我运行这个程序时,我得到“命令执行成功”。 但是,当程序完成时,该过程不会运行。 JVM运行后是否有可能杀死程序? 为什么这不起作用?