In general, if you’re not sure whether Windows or Linux users will use your code, please just make sure your main class is called in this way so everyone can enjoy your app. Java .loader.unopath="/usr/lib/openoffice/program" .loader.Loader. If you’d like to run your app from the command line, make sure the CLASSPATH variable contains the four jar files (juh.jar, jurt.jar, ridl.jar and unoil.jar) and and issue loader.unopath="/usr/lib/openoffice/program" On Debian Linux, this line looks like this Also, make sure the JVM get this property set as well: That this class gets your main class (the one with the main method that is) as argument. Modify the project settings in your IDE in such a way, that the main class that is executed is On Windows this all happens automagically (one of the few benefits of Windows IMHO) but not on Linux unfortunately.
Second of all, the IDE (well, Java actually) also needs to be able to find the soffice.exe (on Windows) or soffice (on Linux) executable.
So, in your library definition also make sure ton include. These classes can be found in and can be recognised by their package, which is .loader. First of all, some classes that are shipped with the SDK need to be in the classpath as well. Make sure the four jars mentioned above (juh.jar, jurt.jar, ridl.jar and unoil.jar) are in it. First, define a library in your favourite IDE and call it. Reall that this needs both the SDK and OOo to be installed on your hard drive. Let’s first try to connect to OOo locally. The other jar files are needed for more exotic stuff that I won’t touch (yet). Besides that, in some cases sandbox.jar also is needed though it is unclear to me at this moment when and why. The jar files from \program\classes that need to be in your classpath are juh.jar, jurt.jar, ridl.jar and unoil.jar. OOo can be started in server mode, listening to a port on a remote server through which you can connect.
However, you DON’T need a complete OOo install in order to make use of it! Or rather, you don’t need a LOCAL installation of OOo to be able to use it. On windows, the default install location is C:\Program files\ 2.0 and on Debian Linux it is /usr/lib/openoffice. These jar files are shipped with OOo and can be found in \program\classes. For Debian Linux, the package you need is called -dev and this will install all files into /usr/share/java/openoffice.īesides the SDK you’ll need a few jar files. On Linux, the OOo SDK should be avalable via your disti’s online install repositories. I chose C:\java\_2.0_SDK but of course the location is up to you and it doesn’t really matter, as long as you remember where you put it. On Windows, the installer that contains the SDK will prompt you for a location to install. At the time of this writing the OOo website seems to be undergoing some upgrades, so you may have to wait some time before it’s back up again. You can download the SDK from the main OOo website. In order to be able to connect to OOo via Java you need to components. Also, my main developing IDE at home is NetBeans, but I’ll try to make everything as IDE independent as possible.
I will do my best to describe everything for both Windows and Linux, since I work on Windows but have my PC at home on Debian Linux.
In this blog I will describe what is necessary to connect to OOo, what pitfalls you may encounter and how to prevent them. What part I will describe depends on my interest, my working together with Geertjan Wielenga of NetBeans and possibly whatever requests I get. In a series of several blogs I will describe a part of this API. The SDK exposes almost all OOo functionality and capabilities to Java through an API.
Besides that, OOo has a very powerfull PDF exporter.For Java developers, the most interesting part of OOo may be the SDK that comes with it. Despite several small issues, (OOo) is capable of opening, modifying and saving Microsoft Office (MSO) documents. is an open source office suite available for Windows, Mac, Linux and Unix.