[英]Migrating Java UNO code from OpenOffice 2.4 to 3.0
I had a nifty small tool written to convert spreadsheets to plain text.我编写了一个漂亮的小工具来将电子表格转换为纯文本。 Since it was my private hacker tool, it relied on OpenOffice 2.x to read the files.由于它是我的私人黑客工具,它依赖于 OpenOffice 2.x 来读取文件。
But when I installed OpenOffice 3 and tried to get it get it to run, I failed miserably, because I'm either missing some JAR files or half the classes have been replaced.但是当我安装OpenOffice 3并试图让它运行时,我失败了,因为我要么丢失了一些 JAR 文件,要么已经替换了一半的类。
I'm including all five JAR files from URE/Java (URE: UNO Runtime Environment, a subset of OpenOffice.org hosting and managing UNO components) and am still missing these classes:我包含来自 URE/Java 的所有五个 JAR 文件(URE: UNO运行时环境,OpenOffice.org 托管和管理 UNO 组件的一个子集),但仍然缺少这些类:
com.sun.star.frame.XComponentLoader
com.sun.star.frame.XController
com.sun.star.frame.XDesktop
com.sun.star.frame.XModel
com.sun.star.frame.XStorable
com.sun.star.sheet.XSpreadsheet
com.sun.star.sheet.XSpreadsheetDocument
com.sun.star.sheet.XSpreadsheetView
com.sun.star.text.XTextDocument
Any pointers?任何指针?
I found what I was missing.我找到了我缺少的东西。
I had to include the following jars我必须包括以下罐子
URE/java/juh.jar
URE/java/jurt.jar
URE/java/ridl.jar
Basis/program/classes/unoil.jar
The last one I was missing before - note the German OOo version .我之前遗漏的最后一个 -请注意德语 OOo 版本。
And, something I didn't have to do before, I had to include the path to the OOo executables, eg而且,我以前不必做的事情,我必须包含 OOo 可执行文件的路径,例如
c:/program/OpenOffice.org 3/program/
After that and without changing code it worked just like before.在那之后,没有改变代码,它就像以前一样工作。
So, Brian, UNO's API is stable even between major releases.所以,Brian,即使在主要版本之间,UNO 的 API 也是稳定的。 It was just the classpath I had to fix.这只是我必须修复的类路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.