I’ve been able to add a new instance of the HelloWorld Java macro to LibreOffice (jar file and parcel-descriptor.xml), following the instructions at [https://wiki.documentfoundation.org/Documentation/DevGuide/Scripting_Framework#Java] (Writing Macros Java)
I am able to execute the macro using Tools>Macros>Run Macro. The Java method executes and produces the expected result
However, when I add the macro to the execute action on a button in a form (in base), a button click produces an error dialog with the message:
A Scripting Framework error occurred while running the Java script org.libreoffice.example.java_scripts.HelloWorld.printHelloWorld.
Message: java.lang.NoSuchMethodException: StrictResolver.getProxy: Can’t find method: printHelloWorld
There is a another version of HelloWorld that is deployed as part of the LibreOffice installation. It exhibits the same behaviour: Run Macro works as expected but Execute Action produces NoSuchMethodException.
There is an old reference to this issue at the end of [https://forum.openoffice.org/en/forum/viewtopic.php?t=1844]( [Java] OOo Writer and Calc macro examples) but the symptom and solution reported there are not believable.
Version: 24.2.3.2 (X86_64) / LibreOffice Community
Build ID: 433d9c2ded56988e8a90e6b2e771ee4e6a5ab2ba
CPU threads: 8; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: en-CA (en_CA); UI: en-US
Calc: threaded
I’m using IntelliJ Idea with Java language level: 8, jdk: Eclipse Adoptium jdk-11.0.14.101
(cmdline) java --version reports
openjdk 11.0.14.1 2022-02-08
OpenJDK Runtime Environment Temurin-11.0.14.1+1 (build 11.0.14.1+1)
OpenJDK 64-Bit Server VM Temurin-11.0.14.1+1 (build 11.0.14.1+1, mixed mode)
so this is presumably what LibreOffice found upon installation.