Gikar Gikar - 1 year ago 111
Java Question

Start and Stop OpenOffice Service using Java code?

I have OpenOffice installed on both a Windows and a Linux machine. I want to write a simple Java application that will connect to OpenOffice remotely and do some file conversion. I want to run OpenOffice as a service on both Windows and Linux on some random port. After the file conversion is done, I want to stop the service.

Answer Source

You need to start first :

soffice -headless -accept="socket,host=,port=8100;urp;" -nofirststartwizard

then use some library to connect and use the service like jodconverter

To call an executable from java :

Process process = new ProcessBuilder("C:\\PathToExe\\MyExe.exe","param1","param2").start();

You gave him your path to openoffice exe, then each parameter (-headless...)

more infos in runtime.exec

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download