| J2EE[tm] Blueprints > Java[tm] Pet Store Administrator > Running the StarOffice demo |
The StarOffice demo illustrates how to import data from the Java Pet Store Administratorusing XML over HTTPinto a StarOffice spreadsheet. This document describes how to set up the demo.
|
Note: These instructions use $JPS_HOME (UNIX) and %JPS_HOME% (Win32) to
denote the root directory of the J2EE Blueprints bundle. |
Before running this demo, make sure the following items are installed on your system:
StarOffice: v5.2 download
When you install StarOffice, make sure to enable it to use the Java Runtime Environment.
StarOffice SDK: v1.0 download
Java API for XML Processing (JAXP): v1.1 download
The following table lists the shorthand forms used to denote the root installation directories of the first two items:
| UNIX | Win32 | |
|---|---|---|
| StarOffice | $STAROFFICE_HOME | %STAROFFICE_HOME% |
| StarOffice SDK | $STAROFFICE_SDK_HOME | %STAROFFICE_SDK_HOME% |
Replace the file sandbox.jar that comes with
StarOffice with the one that comes with the StarOffice SDK.
UNIX: Replace
$SOFFICE_HOME/program/classes/sandbox.jar with
$SOFFICE_SDK_HOME/addon/java/samples/sandbox.jar.
Win32: Replace
%SOFFICE_HOME%\program\classes\sandbox.jar with
%SOFFICE_SDK_HOME%\addon\java\samples\sandbox.jar.
Add the following line to the [Common] section of
$SOFFICE_HOME/user/sofficerc (UNIX) or
%SOFFICE_HOME%\user\soffice.ini (Win32):
Connection=socket,host=localhost,port=8100;iiop;
Open the file $SOFFICE_HOME/user/config/javarc (UNIX)
or %SOFFICE_HOME%\user\config\java.ini (Win32).
Make sure that the SystemClassPath entry in the
[Java] section of the file includes the full paths to the
JAR files sandbox.jar, jurt.jar and
unoil.jar:
| Full paths of JARs | |
|---|---|
| UNIX | $SOFFICE_HOME/program/classes/sandbox.jar$SOFFICE_HOME/program/classes/jurt.jar$SOFFICE_HOME/program/classes/unoil.jar |
| Win32 | %SOFFICE_HOME%\program\classes\sandbox.jar%SOFFICE_HOME%\program\classes\jurt.jar%SOFFICE_HOME%\program\classes\unoil.jar |
Also make sure that the UserClassPath entry in the
[Java] section of the file includes
$JPS_HOME (UNIX) or %JPS_HOME% (Win32), or
create this entry if it doesn't exist. For example, if
%JPS_HOME% is c:\jps1.1.2, then you would
add this line:
UserClassPath=c:\jps1.1.2
Add the full paths to the JAR files sandbox.jar,
jurt.jar and unoil.jar to your
CLASSPATH environment variable. These are listed in the
following table:
| Full paths of JARs | |
|---|---|
| UNIX | $SOFFICE_HOME/program/classes/sandbox.jar$SOFFICE_HOME/program/classes/jurt.jar$SOFFICE_HOME/program/classes/unoil.jar |
| Win32 | %SOFFICE_HOME%\program\classes\sandbox.jar%SOFFICE_HOME%\program\classes\jurt.jar%SOFFICE_HOME%\program\classes\unoil.jar |
Also make sure that the current working directory, denoted by a dot
("."), is part of your CLASSPATH.
Bring up a shell or command prompt, change the current
directory to $JPS_HOME/src/petstoreadmin/staroffice/
(UNIX) or %JPS_HOME%\src\petstoreadmin\staroffice\
(Win32) and execute the following command to compile the demo:
javac PendingOrders.java
Deploy the Java Pet Store and use it to order some pets.
Deploy the Java Pet Store Administrator.
Bring up a command or shell prompt, change the current
directory to $STAROFFICE_HOME/program/ (UNIX) or
%STAROFFICE_HOME%\program\ (Win32), and execute the
following command to start StarOffice:
soffice
Bring up a shell or command prompt, change the current
directory to $JPS_HOME/src/petstoreadmin/staroffice/
(UNIX) or %JPS_HOME%\src\petstoreadmin\staroffice\
(Win32) and execute the following command to start the demo:
java PendingOrders localhost 8000
The program will get the pending orders for the Java Pet Store and display their details in a StarOffice spreadsheet.
|
Note: These instructions assume that the Java Pet Store and Java Pet Store Administrator are deployed on a machine named localhost and port
8000. You should substitute localhost and
8000 with the name of the machine and the port on which
these applications are deployed. |