项目引入 libreoffice ,启动警告如下,不影响文档转换,但是每次启动项目都报这个警告,非常刺眼。警告也很明确,就是说原来用单线 - 转换已过期,使用双线 -- 替代。

问题原因:是安装LibreOffice的路径,toLowerCase后,没有包含libreoffice,所以启动警告。

解决办法:卸载重装,自定义路径toLoweCase后要有libreoffice。

注意:windows系统重装没有任何问题,Linux系统重装失败了,应该是我对这个玩意儿安装技术还不到位原因,留给各位去探索。

 

下面是一些问题过程,有兴趣可以看看。

2025-03-31 14:20:37.795 [Thread-9] ERROR org.jodconverter.local.office.VerboseProcess - Warning: -accept=socket,host=127.0.0.1,port=8100,tcpNoDelay=1;urp;StarOffice.ServiceManager is deprecated.  Use --accept=socket,host=127.0.0.1,port=8100,tcpNoDelay=1;urp;StarOffice.ServiceManager instead.

2025-03-31 14:20:37.795 [Thread-9] ERROR org.jodconverter.local.office.VerboseProcess - Warning: -headless is deprecated.  Use --headless instead.

2025-03-31 14:20:37.795 [Thread-9] ERROR org.jodconverter.local.office.VerboseProcess - Warning: -invisible is deprecated.  Use --invisible instead.

2025-03-31 14:20:37.795 [Thread-9] ERROR org.jodconverter.local.office.VerboseProcess - Warning: -nodefault is deprecated.  Use --nodefault instead.

2025-03-31 14:20:37.795 [Thread-9] ERROR org.jodconverter.local.office.VerboseProcess - Warning: -nofirststartwizard is deprecated.  Use --nofirststartwizard instead.

2025-03-31 14:20:37.795 [Thread-9] ERROR org.jodconverter.local.office.VerboseProcess - Warning: -nolockcheck is deprecated.  Use --nolockcheck instead.

2025-03-31 14:20:37.795 [Thread-9] ERROR org.jodconverter.local.office.VerboseProcess - Warning: -nologo is deprecated.  Use --nologo instead.

2025-03-31 14:20:37.795 [Thread-9] ERROR org.jodconverter.local.office.VerboseProcess - Warning: -norestore is deprecated.  Use --norestore instead.

 

 

这是libreoffice配置,安装home在D:/libOffice,工作路径在D:/libOfficeWorkDir

网上查了很多,说是使用Bean重写LibreOffice的Manager,在里面使用runArgs(...),就是使用自定义命令。但是都不靠谱,跟这启动不搭边。

 

找了几天都没有找到解决办法,于是只能靠自己,启动debug日志查找,终于找到了报错的地方

2025-03-31 14:20:37.641 [jodconverter-offprocmng-0] DEBUG o.j.local.office.LocalOfficeProcessManager - ProcessBuilder command: D:\libOffice\program\soffice.exe -accept=socket,host=127.0.0.1,port=8100,tcpNoDelay=1;urp;StarOffice.ServiceManager -headless -invisible -nocrashreport -nodefault -nofirststartwizard -nolockcheck -nologo -norestore -env:UserInstallation=file:///D:/libOfficeWorkDir/.jodconverter_socket_host-127.0.0.1_port-8100_tcpNoDelay-1

在这里,先找到soffice.exe所在根路径,我安装的是LibreOffice24.8,

 

 他这里作了个判断,如果根路径toLowerCase后,包含了 libreoffice,哪么就设置libreoffice参数,否则就是openoffice。

 再看LibreOffice默认安装路径,包含了LibreOffice。

 

这里回到原点,我是自定义安装,路径为D:libOffice,所以这里判断走不进去,就走的别的命令。

这个也不能怪开发人员把这里写死了,他也是想着能自动判断,省略大家工作量。

但是有的人,像我这样,安装软件不喜欢默认,更不喜欢安装在C盘,喜欢自定义,所以会有这样一个问题。

重新安装后,启动项目就没有报命令警告了。