[Libreoffice-bugs] [Bug 117331] Remove Split Package for Java 9 compatibility
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Mon Jun 3 16:46:12 UTC 2019
https://bugs.documentfoundation.org/show_bug.cgi?id=117331
--- Comment #5 from Rick Heckadon <rickh at decisioninsight.com> ---
I'm having the same issue, but it's because I've included JavaFX 11 in my
project. JavaFX 11 uses the new Java Modular system that was released in Java
version 9. This means that when the project is compiled, any non modular
libraries (i.e. LibreOffice Java API) are put into the unnamed module, where
each jar file is treated as a module. Since ridl, unoil, juh, and jurt are all
separate jar files, they are each treated like their own separate module. This
is usually fine, except each jar shares liked named packages (i.e. ridl and
jurt both have a package called com.sun.star.lib.util), which in the Java
Modular system are called split packages. Before the Modular system, this was
allowed to work without a hitch, but it's a non-starter with Java 9 on and
causes errors that stops the project from compiling.
I have an example project that creates a JavaFX window with a button in it that
would create an the SWriter example doc when clicked, but I'm not sure how to
share it with everyone? The project uses NetBeans 11.0, AdoptOpenJDK 11, and
JavaFX 11. If I can't share the code, you may be able to setup the project
yourself by merging the JavaFX 12 helloworld example and the SWriter example.
HelloWorld is here: https://github.com/openjfx/samples. And the Swriter
example is here:
https://api.libreoffice.org/examples/examples.html#Java_examples.
I think that the best way to solve this issue and still be compatible with
older Java versions (Java 8), is to put ridl, unoil, juh, and jurt into a
single jar file for Java 9 projects and above, but still have the 4 separate
jars for Java 8 projects and below. By doing this, the Modular system would
treat the single jar file as a single module. The modular system would then
not flag this module as having split packages and the project could compile
correctly.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190603/321d0dcb/attachment.html>
More information about the Libreoffice-bugs
mailing list