The common preparation is usually enough unless you are going to create a UNO interface. Really, it is simple.
Topics
About: UNO (Universal Network Objects)
About: LibreOffice
About: Apache OpenOffice
About: The Java programming language
The table of contents of this article
- Starting Context
- Target Context
- Orientation
- Main Body
- 1: What "Common" Means
- 2: The Matter-Of-Course Prerequisit
- 3: Setting the Classes Paths to 4 Jar Files
- 4: Enjoy
- 5: If You Are Going to Create a UNO Interface . . .
Starting Context
- The reader has a basic knowledge on LibreOffice or Apache OpenOffice.
- The reader has a knowledge on what UNO is and how UNO is related to LibreOffice or Apache OpenOffice.
- The reader has a basic knowledge on the Java programming language.
Target Context
- The reader will know how to do the minimal common preparation for starting Java UNO programming.
Orientation
An extensive preparation for starting any UNO programming has been described in a previous article for Linux or Windows.
How to make any LibreOffice or Apache OpenOffice instance a UNO server has been described in a previous article.
A Java console external program sample has been introduced in a previous article.
A Java GUI external program sample has been introduced in a previous article.
How to create any UNO interface will be addressed in a future article.
How to create any UNO component will be addressed in a future article.
How to create any UNO service will be addressed in a future article.
Main Body
Stage DirectionHere are Hypothesizer 7, Objector 52A, and Objector 52B in front of a computer.
1: What "Common" Means
Hypothesizer 7
I said "Common" in the title because the preparation can be different for your targeted artifact.
Objector 52A
My "targeted artifact"? It is a UNO program.
Hypothesizer 7
Sir, is it an external program, a macro, a global UNO service, or a spread sheet cell function?
Objector 52A
Well, what does "external program" mean?
Hypothesizer 7
External program is a client to a UNO server (usually, a LibreOffice or Apache OpenOffice instance) that (the client) runs as a process external to the server process.
On the other hand, any non-external program runs inside a LibreOffice or Apache OpenOffice instance process.
Objector 52A
Then, I seem to create an external program.
Hypothesizer 7
Then, the common preparation will be usually enough for building it.
Objector 52A
"usually"?
Hypothesizer 7
Will you create a UNO interface?
Objector 52A
Being asked so . . .. I don't even know what UNO interface is.
Hypothesizer 7
Usually, you will not, in external programs.
Objector 52A
Why not?
Hypothesizer 7
UNO interface is for exposing your UNO object to other programming language runtime environments; you usually do not want to expose your UNO object in your external program, do you?
Objector 52A
I don't think I do.
Hypothesizer 7
Note that we have talked about building a program; in order to run the program, you have to make the LibreOffice or Apache OpenOffice instance a UNO server or enable a JVM in the LibreOffice or Apache OpenOffice instance, depending on whether your program is an external program or a non-external program.
2: The Matter-Of-Course Prerequisit
Hypothesizer 7
We need to install LibreOffice or Apache OpenOffice and JDK, of course.
I assume that there is no need to explain how to install them, here (although I have explained them in an article for an extensive preparation for Linux or Windows).
Objector 52B
Why do you assume so?
Hypothesizer 7
Madam, the way depends on your environment, and the document of each product should be enough.
Objector 52B
I hope so.
Hypothesizer 7
By the way, you do not need to install LibreOffice or Apache OpenOffice SDK for the sake of the common preparation.
Objector 52B
Hmm.
3: Setting the Classes Paths to 4 Jar Files
Hypothesizer 7
We need to set the classes paths to 4 Jar Files, 'unoil.jar', 'jurt.jar', 'ridl.jar', and 'juh.jar' in the 'program/classes' directory of the LibreOffice or Apache OpenOffice product directory.
Whether you use a build tool like Gradle or an IDE like Eclipse, you know how to do so, don't you?
Objector 52A
Don't piss on me! That's elementary, my dear Watson, elementary.
Hypothesizer 7
. . . My name is not "Watson".
4: Enjoy
Hypothesizer 7
That is all.
Objector 52B
Is that all?
Hypothesizer 7
Yes, it is.
Objector 52B
That's too brief . . .
Hypothesizer 7
What did you expect? In order to build a Java program, you need to just set the classes paths to the used classes, right? What else can there be?
Objector 52B
None, I presume.
Hypothesizer 7
You are right, madam.
5: If You Are Going to Create a UNO Interface . . .
Hypothesizer 7
If you are going to create a UNO interface, there are more things to do in the preparation, which will be addressed in a future article.