Bug 111436 - Allow external tools to interact with LibreOffice running inside Flatpak, include Java JARs
Summary: Allow external tools to interact with LibreOffice running inside Flatpak, inc...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Installation (show other bugs)
Version:
(earliest affected)
5.3.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL: http://discourse.jabref.org/t/support...
Whiteboard:
Keywords:
Depends on:
Blocks: LibreOffice-Flatpak
  Show dependency treegraph
 
Reported: 2017-08-07 14:44 UTC by Dennis Schridde
Modified: 2018-11-28 09:43 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Schridde 2017-08-07 14:44:24 UTC
External tools like JabRef [1] support integrating with LibreOffice [2].  However, this is broken when LibreOffice is installed as a Flatpak, the first problem surfacing being that the LibreOffice Flatpak does not include the necessary JARs [3].  There might be follow up problems regarding to namespaces, but I did not investigate that far, yet.

[1]: https://www.jabref.org/
[2]: http://help.jabref.org/en/OpenOfficeIntegration
[3]: http://discourse.jabref.org/t/support-flatpaked-libreoffice/744
Comment 1 Stephan Bergmann 2017-08-29 13:22:34 UTC
I don't know which JARs exactly you are talking about.

Due to Flatpak's sandboxed nature, it can be difficult to access an app's special-purpose interfaces (like LO's Java UNO interface) from the outside.
Comment 2 Dennis Schridde 2017-08-29 17:27:47 UTC
(In reply to Stephan Bergmann from comment #1)
> I don't know which JARs exactly you are talking about.

Christoph Siedler (JabRef) says that the following JARs are needed:
* unoil.jar
* jurt.jar
* juh.jar
* ridl.jar

> Due to Flatpak's sandboxed nature, it can be difficult to access an app's
> special-purpose interfaces (like LO's Java UNO interface) from the outside.

Given the list of JARs above: What would be necessary changes to Flatpak, to support this?

As a next step, I would open a feature request for Flatpak (or reference one that already exists, if I find one), asking for those changes to Flatpak.
Comment 3 Xisco Faulí 2018-11-27 14:53:21 UTC
@Stephan Bergmann, Please see comment 2
Comment 4 Stephan Bergmann 2018-11-28 09:43:09 UTC
When external (C++ or Java) programs want to communicate with LO via the UNO Remote Protocol (URP), those programs need access to certain libraries (C++ dynamic libraries or Java jars, resp.) and helper data and code files (e.g., even in the case of Java jars, these reference native code that is implemented in helper native dynamic libraries; see <https://wiki.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide> for details on all this).

LO includes all these files, so one way of obtaining access to those files is to ask the LO installation that the external program wants to target about the location of those files.  This is done with the unoinfo helper executable (see desktop/README.md for details).  However, in the case of flatpak, something like `flatpak run --command=/app/libreoffice/program/unoinfo org.libreoffice.LibreOffice java` isn't useful to a program outside the LO flatpak sandbox, as the reported paths don't exist outside that flatpak.  So, to make that work, some way of accessing a flatpak's arbitrary data and code files from outside the flatpak would be necessary, and some mechanism by which the paths that unoinfo reports can be mapped from flatpak-internal to flatpak-external paths.

However, URP and the software artefacts necessary to speak it are evolved compatibly, so it generally works to make an external program use such files that don't come from the targeted LO installation, but rather from a different source.  There has been such a standalone UNO Runtime Environment (URE) in the past, but it has been abandoned for lack of maintenance support (though its traces and concepts are still there in the code, and e.g. some Linux distros still maintain it as a separate LO sub-package).  Such a URE running outside the flatpak (and potentially bundled with the external program) would be an alternative approach to solve this issue.