Zotero LibreOffice Integration comprises extensions for LibreOffice and Zotero that communicate using local web servers.
- LibreOffice 26.2+
- JDK with
javacandjaravailable onPATH zip
To build:
- Copy
scripts/config.sh-sampletoscripts/config.shand setLIBREOFFICE_INSTALL_PATHto your LibreOffice installation path, for example/opt/libreoffice26.2. If this is unset,scripts/symlink_sdkwill try common platform-specific locations. - Run
scripts/symlink_sdkto link LibreOffice's Java UNO libraries intobuild/lib/libreoffice-sdk. - Run
scripts/build.shfrom the repository root. This compiles the Java sources, buildsZotero.jar, and packagesinstall/Zotero_LibreOffice_Integration.oxt. - Install
install/Zotero_LibreOffice_Integration.oxtinto LibreOffice, by runningscripts/install_oxt.sh, choosing "Reinstall Extension" from within the Zotero preferences, or by installing it manually from within LibreOffice.- If, when you try to install the extension in LibreOffice, you get an error like "Could not create Java implementation loader", it means that LibreOffice is not configured to use Java. Follow these instructions to set up a Java VM in LibreOffice.
This extension consists of a LibreOffice UNO based java extension for LibreOffice. The UNO runtime allows various programming languages to interface with a running LibreOffice process. The extension code is initialized by LibreOffice and starts execution in ZoteroOpenOfficeIntegrationImpl.java.
Communication between Zotero and LibreOffice is mediated in zoteroLibreOfficeIntegration.js where a TCP socket is initialized and used for both sending and receiving messages. The complimentary socket connection on the LibreOffice extension end is found in CommServer.java.
The Java extension code can be debugged directly during runtime.
Follow these instructions to enable debugging in LibreOffice. After restarting, LibreOffice will freeze the until a debugging client connects. Create a remote debugging configuration in Eclipse and run it:
- In Eclipse, click on "Run" -> "Debug Configurations...".
- In the left list, select "Remote Java Application".
- In the button bar, press the first button "New launch configuration".
- Use the same port you configured LibreOffice with. The default is port 8000.
- Press "Debug".
LibreOffice will unfreeze. If you add breakpoints in Eclipse they will be triggered freezing the LibreOffice process and allowing you to inspect the execution environment. This technique can be used to debug on remote or virtual machines too.