Why is Java needed for running macros on Libreoffice?

I get the message: “Libreoffice requires a Java runtime environment” whenever I try to use macros, but I am curious about why it is needed. Anyone has an answer? Thanks!

It is a kind of bug. LibreOffice does not need Java to run macros written in other languages (=StarBasic or Python). But the process of finding a script provider in LibreOffice takes each registered script provider until it finds one that handles a given script; and when there’s a Python macro in LibreOffice, it happens that Python provider is alphabetically after Java provider; so the process here is this:

  1. LibreOffice found some script (it is actually a Python script)
  2. It starts enumerating providers; first is BASIC - it rejects (does not handle this kind of scripts)
  3. Next provider is for Java. If it is disabled, now you see the warning. If you allow here, the script provider is activated, then tests the script, and naturally rejects. If you don’t allow, it is skipped.
  4. Then Python provider is tested, and it accepts the script.

Hope this helps understanding the process. I tried to come with a quick fix, but here something more substantial is needed than a quick fix.

Edit 2018-10-08: addressed in tdf#120362 and tdf#120363 for version 6.2.

Hi @mikekaganski - Thank you for this explanation that I had never read before. I upvote your answer :slight_smile:

Regards

Well - this is related to my (incorrect) comment to this topic. I then tried to find the problem, and to fix that… unsuccessfully.

Thanks Mike!