FreeBSD OpenOffice.org porting status page : How to use SDK (OOo 1.1.x)
$Id:
by OpenOffice.org porting team, NAKATA, Maho, and Jackson LowHow to use SDK (OOo 1.1.x series)
This page explains how to use SDK. I intentionally set the version of OOo as 1.1.4, but you can change 1.1.4 to 1.1.3, 1.1.5, or whatever you have so that it matches your environment.- Install OpenOffice.org 1.1.4 for FreeBSD
You know what I mean :)
- Install gmake
If you haven't installed gmake, please install it.
# cd /usr/ports/devel/gmake ; make install clean
- Install Java (optional, but recommended for first try)
Ah, you don't like Java :)
# cd /usr/ports/java/jdk14 ; make install clean
- Obtain SDK
You can obtain SDK here. We have prepared SDK for the 4.x-series and 5.x-series. Please make sure you obtain the SDK for the operating system you are using or make it by yourself. Instructions for builing SDK are described in the How to build section on the main page.
- Setting up SDK
% mkdir /work/tmp % cd /work/tmp % tar zxf <somewhere>/OOo_1.1.4_FreeBSD53Intel_sdk.tar.gz % cd OpenOffice.org1.1.4_SDK/ % ./configure ./configure *** Configure your SDK environment *** Enter the Office Software Development Kit directory [/work/tmp/OpenOffice.org1.1.4_SDK]: Enter the Office installation directory [/home/maho/OpenOffice.org1.1.4]: /usr/local/OpenOffice.org1.1.4 Enter GNU make (3.79.1 or higher) tools directory [/usr/local/bin]: C++ Compiler where a language binding exist: Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher Linux, GNU C++ compiler, gcc version 3.0.1 or higher Enter C++ tools directory (optional) [/usr/bin]: Enter Java SDK (1.4.1_01 or higher) installation directory [/usr/local]: /usr/local/jdk1.4.2 NOTE!!!: If you choose Java 5.0 or higher, you have to ensure that your installed office installation is configured to use Java 5.0 as well. Automatic deployment of UNO components (YES/NO) [YES]: For using your prepared environment, please run the "setsdkenv_unix" script file!
Just hit enter except two points:
First,Enter the Office installation directory [/home/maho/OpenOffice.org1.1.4]: /usr/local/OpenOffice.org1.1.4
You must enter (basically from packages or ports, installation directory is /usr/local/OpenOffice.org1.1.4)
Second,Enter Java SDK (1.4.1_01 or higher) installation directory [/usr/local]: /usr/local/jdk1.4.2
Same as above.
- Use of SDK
After you have completed your SDK setup, you need to set environmental variables before it can used. Please type:
% ./setsdkenv_unix Starting shell with SDK environment.
Now you can use your OpenOffice.org SDK. Congratulations! - Make OpenOffice.org listen
OpenOffice.org itself can communicate via the TCP/IP port. Java uses a TCP/IP socket to talk to Openoffice.org. First, the samples are written in Java, so we need to have Java installed. Default settings of OOo do not listen via TCP/IP, so you must invoke OpenOffice.org with "-accept=socket,port=2083;urp;":
% openoffice.org-1.1.4 "-accept=socket,port=2083;urp;"
Is OOo really listening? Please check by typing:% netstat -a | grep 2083 tcp4 0 0 localhost.2083 *.* LISTEN
Okay, OOo is really listening to your voice :)
You can change the port number from 2083 to 8100 or any port number you'd like to use. - Sample programs
You might also be interested in the sample programs. Type ./setsdkenv_unix as described above to use them.
% ./setsdkenv_unix Starting shell with SDK environment.
Next, invoke OpenOffice.org with listening support via TCP/IP% openoffice.org-1.1.4 "-accept=socket,port=2083;urp;"
and cd to examples/DevelopersGuide/FirstSteps/% cd examples/DevelopersGuide/FirstSteps/
This directory contains some very basic sample programs.% gmake -------------------------------------------------------------------------------- Please use one of the following commands to execute the examples! - make FirstConnection.run make FirstLoadComponent.run make HelloTextTableShape.run --------------------------------------------------------------------------------
Type gmake FirstConnection.run, instead of typing make FirstConnection.run, since the name of GNU make is gmake for (usual) FreeBSD.% gmake FirstConnection.run "/usr/local/jdk1.4.2/bin/java" -classpath "/usr/local/OpenOffice.org1.1.4/prog ram/classes/jurt.jar:/usr/local/OpenOffice.org1.1.4/program/classes/unoil.jar: /usr/local/OpenOffice.org1.1.4/program/classes/ridl.jar:/usr/local/OpenOffice. org1.1.4/program/classes/sandbox.jar:/usr/local/OpenOffice.org1.1.4/program/cl asses/juh.jar::../../../FREEBSDexample.out/class/FirstStepsExamples" FirstConnection remote ServiceManager is available
Connection is established and sample program worked! Congratulations!
Next, FirstLoadComponent. This program opens a calc sheet and insert 21 to the A1 and A2 cells. A sum of A1 and A2 are performed and the result is written to the A3 cell.% gmake FirstLoadComponent.run "/usr/local/jdk1.4.2/bin/java" -classpath "/usr/local/OpenOffice.org1.1.4/prog ram/classes/jurt.jar:/usr/local/OpenOffice.org1.1.4/program/classes/unoil.jar:/ usr/local/OpenOffice.org1.1.4/program/classes/ridl.jar:/usr/local/OpenOffice. org1.1.4/program/classes/sandbox.jar:/usr/local/OpenOffice.org1.1.4/program/cl asses/juh.jar::../../../FREEBSDexample.out/class/FirstStepsExamples" FirstLoadComponent com.sun.star.sheet.XSpreadsheet Formula cell in column 0, row 2 contains =SUM(A1:A2)
HelloTextTableShape is interesting. This automatically creates Writer, Calc, and Draw!% gmake HelloTextTableShape.run
- Listening port by default
For some (maybe security) reason, OOo itself doesn't listen by default. You must invoke it with command line arguments. But if you always talk to OOo with TCP/IP sockets, it becomes tedious. To make OOo listen by default, apply the following patch by *HAND* (sorry) for /usr/local/OpenOffice.org1.1.4/share/registry/data/org/openoffice/Setup.xcu as root,
--- share/registry/data/org/openoffice/Setup.xcu.orig +++ share/registry/data/org/openoffice/Setup.xcu @@ -1,6 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Setup" oor:package= "org.openoffice"> <node oor:name="Office"> + <prop oor:name="ooSetupConnectionURL" oor:type="xs:string"> + <value>socket,port=2083;urp;</value> + </prop> <prop oor:name="ooSetupInstCompleted"> <value>false</value> </prop>
Again, please check netstat% openoffice.org-1.1.4 % netstat -a | grep 2083 tcp4 0 0 localhost.2083 *.* LISTEN
- Troubleshooting
If you get messages when trying to run FirstConnection,
% gmake FirstConnection.run mkdir -p ../../../FREEBSDexample.out/class/FirstStepsExamples "/usr/local/jdk1.4.2/bin/javac" -classpath "/usr/local/OpenOffice.org1.1.4/ program/classes/jurt.jar:/usr/local/OpenOffice.org1.1.4/program/classes/unoil. jar:/usr/local/OpenOffice.org1.1.4/program/classes/ridl.jar:/usr/local/OpenOff ice.org1.1.4/program/classes/sandbox.jar:/usr/local/OpenOffice.org1.1.4/program /classes/juh.jar::../../../FREEBSDexample.out/class/FirstStepsExamples" -d ../ ../../FREEBSDexample.out/class/FirstStepsExamples FirstConnection.java First LoadComponent.java HelloTextTableShape.java "/usr/local/jdk1.4.2/bin/java" -classpath "/usr/local/OpenOffice.org1.1.4/prog ram/classes/jurt.jar:/usr/local/OpenOffice.org1.1.4/program/classes/unoil.jar: /usr/local/OpenOffice.org1.1.4/program/classes/ridl.jar:/usr/local/OpenOffice. org1.1.4/program/classes/sandbox.jar:/usr/local/OpenOffice.org1.1.4/program/cl asses/juh.jar::../../../FREEBSDexample.out/class/FirstStepsExamples" FirstConnection com.sun.star.connection.NoConnectException: java.net.ConnectException: Connection refused at com.sun.star.lib.connections.socket.socketConnector.connect(socketConnector.java:194) at com.sun.star.comp.connections.Connector.connect(Connector.java:172) at com.sun.star.comp.urlresolver.UrlResolver$_UrlResolver.resolve(UrlResolver.java:159) at FirstConnection.getRemoteServiceManager(FirstConnection.java:97) at FirstConnection.useConnection(FirstConnection.java:68) at FirstConnection.main(FirstConnection.java:56)
there are two possibilities.- Is OpenOffice.org is actually running?
- Is the port number correct? Many documents available via the Internet write using the port number 8100. Somehow, FirstConnection.java communicate via #2083. Please check your port number.