config jre for openoffice3.0
如果使用openoffice解析word文件,大家知道是需要配置jre的,一般做法是这样的:
- 启动openoffice
- 选择Tools-->Options
- 选择OpenOffice.org下的Java选项
- 然后选择适当的jre,点击OK,重启openoffice即可,如下图:
问题:
openoffice默认的jre是系统自带的,可以通过如上方式换成我们常用的JDK版本,但是如果服务器是批量生产的,如上的手动设置岂不太过繁琐?如何通过命令或者脚本更改呢?
通过查阅openoffice官方文档,有如下描述:
The configuration is stored in
< staroffice-config > /user/config/javasettings_ < platform > .xml
Just delete this file if you wantStarOfficeto detect again. The Java configuration file cannot be modified manually. The data format is not specified and may change anytime without further notice. Don't try to modify that file to change the Java version. The < location > and < version > entries are only for 'documentation', the Java version is accessed via the < vendorData > , which is binary.
解决方法:
使用locate命令查找javasettings配置文件,发现位于如下目录:
/root/.ooo3/user/config/javasettings_Linux_x86.xml
将一个已经配置好JRE的服务器上的openoffice配置文件(javasettings_Linux_x86.xml)拷贝到尚未配置的机器上,启动openoffice,果然好了,特记录之。
附录:
javasettings_Linux_x86.xml文件内容如下:
<?xml version="1.0" encoding="UTF-8"?> <!--This is a generated file. Do not alter this file!--> <java xmlns="http://openoffice.org/2004/java/framework/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <enabled xsi:nil="true"/> <userClassPath xsi:nil="true"/> <vmParameters xsi:nil="true"/> <jreLocations xsi:nil="true"/> <javaInfo xsi:nil="false" vendorUpdate="2004-01-30" autoSelect="true"> <vendor>Sun Microsystems Inc.</vendor> <location>file:///usr/lib/jvm/java-1.6.0-openjdk-1.2_b11/jre</location> <version>1.6.0_0</version> <features>1</features> <requirements>1</requirements> <vendorData>660069006C0065003A002F002F002F007500730072002F006C00690062002F006A0076006D002F006A006100760061002D0031002E0036002E0030002D006F00700065006E006A0064006B002D0031002E0032005F006200310031002F006A00720065002F006C00690062002F0069003300380036002F0063006C00690065006E0074002F006C00690062006A0076006D002E0073006F000A002F007500730072002F006C00690062002F006A0076006D002F006A006100760061002D0031002E0036002E0030002D006F00700065006E006A0064006B002D0031002E0032005F006200310031002F006A00720065002F006C00690062002F0069003300380036002F0063006C00690065006E0074003A002F007500730072002F006C00690062002F006A0076006D002F006A006100760061002D0031002E0036002E0030002D006F00700065006E006A0064006B002D0031002E0032005F006200310031002F006A00720065002F006C00690062002F0069003300380036002F006E00610074006900760065005F0074006800720065006100640073003A002F007500730072002F006C00690062002F006A0076006D002F006A006100760061002D0031002E0036002E0030002D006F00700065006E006A0064006B002D0031002E0032005F006200310031002F006A00720065002F006C00690062002F0069003300380036000A00</vendorData> </javaInfo> </java>
注意:本文件仅可替换,不可修改,<vendorData>中的内容才为真正的版本号说明。