jodConverter 4.2.2
Windows 10
amazon corretto 8 for the java jdk,1.8.0_212
从 IntelliJ 社区(最新)
LibreOffice 6.1.3.1(64 位)运行 - 已安装并运行良好
我尝试运行这段简单的代码(请原谅格式错误):
import org.jodconverter.office.OfficeManager;
import org.jodconverter.office.LocalOfficeManager;
import org.jodconverter.JodConverter;
import org.jodconverter.office.OfficeUtils;
import java.io.File;
public class Main {
public static void main(String[] args) {
OfficeManager officeManager = LocalOfficeManager.builder()
.install()
.officeHome("C:\\Program Files\\LibreOffice")
.build();
File inputFile = new File("c:\\users\\dlawler\\desktop\\test.rtf");
File outputFile = new File("c:\\users\\dlawler\\desktop\\test.pdf");
try {
// Start an office process and connect to the started instance (on port 2002).
officeManager.start();
// Convert
JodConverter
.convert(inputFile)
.to(outputFile)
.execute();
} catch (OfficeException e) {
} finally {
// Stop the office process
OfficeUtils.stopQuietly(officeManager);
}
}
}
我收到一个在屏幕上弹出的错误:
LoadLibrary 失败并出现错误 87:参数不正确
这是日志:
2019-07-03 17:21:40 调试 AbstractProcessManager:140 - 命令行匹配!返回 pid:25300 2019-07-03 17:21:40 INFO OfficeProcess:402 - 已启动进程;pid = 25300 2019-07-03 17:21:40 调试 OfficeConnection:91 - 使用 connectString 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1' 2019-07-03 17:21:42 调试 OfficeConnection :91 - 使用 connectString 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1' 连接 2019-07-03 17:21:43 调试 OfficeConnection:91 - 使用 connectString 'socket,host=127.0.0.1 连接, port=2002,tcpNoDelay=1' 2019-07-03 17:21:44 调试 OfficeConnection:91 - 使用 connectString 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1' 2019-07-03 17 连接: 21:45 调试 OfficeConnection:91 - 使用 connectString 'socket,host=127.0.0.1,port=2002,tcpNoDelay=1' 连接 doStartProcessAndConnect(OfficeProcessManager.java:104) at org.jodconverter.office.OfficeProcessManager.access$100(OfficeProcessManager.java:40) at org.jodconverter.office.OfficeProcessManager$4.call(OfficeProcessManager.java:261) at org.jodconverter.office .OfficeProcessManager$4.call(OfficeProcessManager.java:256) 在 java.util.concurrent.FutureTask.run(FutureTask.java:266) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 在 java.util .concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 原因:org.jodconverter.office.OfficeConnectionException: Connection failed: 'socket,host=127.0 .0.1,端口=2002,tcpNoDelay=1'; java.net.ConnectException:连接被拒绝:在 org.jodconverter.office 连接。NullPointerException 在 org.jodconverter.office.OfficeProcessManager.doStopProcess(OfficeProcessManager.java:124) 在 org.jodconverter.office.OfficeProcessManager.access$000(OfficeProcessManager.java:40) 在 org.jodconverter.office.OfficeProcessManager$5.call(OfficeProcessManager. java:283) at org.jodconverter.office.OfficeProcessManager$5.call(OfficeProcessManager.java:278) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1149) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 在 java.lang.Thread.run(Thread.java:748) 2019-07-03 17:21:48 INFO OfficeProcess:206 - 试图强制终止进程:'host=127.0.0.1,port=2002,tcpNoDelay=1'; pid: 25300 2019-07-03 17:21:
进程以退出代码 0 结束
任何关于寻找什么的想法都将不胜感激。我想知道赛门铁克是否阻止了这些端口?64位/32位不匹配?