Problem with starting OpenOffice service (soffice) from Java (command working in commandline, but no
Posted
by Shervin
on Stack Overflow
See other posts from Stack Overflow
or by Shervin
Published on 2008-12-18T16:10:46Z
Indexed on
2010/05/19
21:40 UTC
Read the original article
Hit count: 320
I want to exceute a simple command which works from the shell but doesn't work from Java. This is the command I want to execute, which works fine:
soffice -headless "-accept=socket,host=localhost,port=8100;urp;"
This is the code I am excecuting from Java trying to run this command:
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");
When I run this program I get "Commands executed successfully". However the process is not running when the program finishes. Is it possible that the JVM kills the program after it has run?
Why doesn't this work?
© Stack Overflow or respective owner