Java Ubuntu使用JODconverter和openoffice将文档转换为pdf

Java Ubuntu使用JODconverter和openoffice将文档转换为pdf,java,pdf,ubuntu,Java,Pdf,Ubuntu,我已安装java和openoffice,但收到以下错误消息: root@ubuntu:/var/www/html# java -jar JODConverter/jodconverter-3.0-beta-1.jar test.doc test.pdf Exception in thread "main" java.lang.IllegalArgumentException: officeHome doesn't exist: /opt/openoffice.org3 at net.sf.jod

我已安装java和openoffice,但收到以下错误消息:

root@ubuntu:/var/www/html# java -jar JODConverter/jodconverter-3.0-beta-1.jar test.doc test.pdf
Exception in thread "main" java.lang.IllegalArgumentException: officeHome doesn't exist: /opt/openoffice.org3
at net.sf.jodconverter.office.ManagedOfficeProcess.<init>(ManagedOfficeProcess.java:58)
at net.sf.jodconverter.office.ManagedProcessOfficeManager.<init>(ManagedProcessOfficeManager.java:89)
at net.sf.jodconverter.office.ManagedProcessOfficeManager.<init>(ManagedProcessOfficeManager.java:85)
at net.sf.jodconverter.cli.Convert.getOfficeManager(Convert.java:120)
at net.sf.jodconverter.cli.Convert.main(Convert.java:97)
root@ubuntu:/var/www/html#java-jar JODConverter/JODConverter-3.0-beta-1.jar test.doc test.pdf
线程“main”java.lang.IllegalArgumentException中的异常:officeHome不存在:/opt/openoffice.org3
位于net.sf.jodconverter.office.ManagedOfficeProcess。(ManagedOfficeProcess.java:58)
在net.sf.jodconverter.office.managedProcessOffice管理器上。(managedProcessOffice管理器.java:89)
在net.sf.jodconverter.office.managedProcessOffice管理器上。(managedProcessOffice管理器.java:85)
位于net.sf.jodconverter.cli.Convert.getOfficeManager(Convert.java:120)
位于net.sf.jodconverter.cli.Convert.main(Convert.java:97)

您可以这样设置Office Home(第二个设置器):

您确定“officeHome”路径正确吗?使用“whereis”命令检查。“officeHome”路径为空。如何添加路径?
// create the officemanager with the given settings
officeManager = new DefaultOfficeManagerConfiguration()
    // either socket or pipe, pipe is faster but requires native libraries
    .setConnectionProtocol(OfficeConnectionProtocol.SOCKET)
    // the installation directory of the openoffice installation
    .setOfficeHome(new File(officeHome))
    // the amount of ports in the array determines how many instances are managed
    .setPortNumbers(portNumbers)
    // after how many tasks the process is restarted as a work around to the known memory leaks in openoffice
    .setMaxTasksPerProcess(maxTasksPerProcess)
    // how long a task can run before it is considered timed out, default is 2 min
    .setTaskExecutionTimeout(taskExecutionTimeout)
    // how long the code waits for a process to become available, default is 30 seconds
    .setTaskQueueTimeout(taskQueueTimeout)
    .buildOfficeManager();