Scriptforge asks to activate Java (JRE) even if you don't need it

Hi!
I am running this Scriptforge code:

from scriptforge import CreateScriptService

def msgbox_last_row(*args):
    bas = CreateScriptService("Basic")
    myDoc = CreateScriptService("Calc", bas.ThisComponent)
    last_row = myDoc.LastRow('Sheet1')
    bas.MsgBox(last_row)

The case is that, every time the document is loaded and the script is executed, Libreoffice asks if I want to activate Java (JRE), since it is necessary to run the script.
However this is not true, since even if it is not activated and the message is closed, the code runs without problem.

I would like to know two things:

  1. Why is it asking me to activate it when using Scriptforge?
  2. How can I stop it from asking me to activate it every time I open the document? Even more so when I have this option explicitly disabled.

Thank you very much!!!

How exactly are you running it? And which exact version of LibreOffice do you use?

I am using LibreOffice 25.2 (latest), but it has happened before.
I am running the script through Macros menu or through a button click event.(it happens with or without using APSO)

So you have that code as a .py somewhere in your profile, or in a document?

Yes, Exactly!

or

?
I’m confused.

py.ods (8.9 KB)

Aha, I see the problem with the document that I had to create myself. You may want to file a bug report.

Sorry I understood profile as LibreOffice python folder or document as a file embedded with APSO in the document.
Both of them are correct. It happens in any way.
I attach a project with the script inserted in the document with APSO.
example.ods (15.3 KB)
EDIT: OK, I saw your edit! So it may be a bug then?

Yes, it’s (or at least may be) a bug. SF has _FindModuleFromMethod function, which calls getChildNodes from macro organizer; and that tries to load Java, because indeed one of its nodes is Java. But the function explicitly only wants Basic.

It seems like they could use ScriptProviderForBasic service instead.

I cannot reproduce neither with
edit: yes, with disabled Java I can reproduce!

Version: 25.8.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: 186e997c559c7e5d4b9462f9b4be6a935cdd04cd
CPU threads: 4; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

or

Version: 25.2.0.3 (AARCH64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 4; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Flatpak
Calc: threaded

or

Version: 7.4.7.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 4; OS: Linux 6.6; UI render: Skia/Vulkan; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Debian package version: 4:7.4.7-1+deb12u6
Calc: threaded

Doesnt matter if the call happens via APSO , via …Execute or …Organize…Python…

@karolus: do you have Java disabled in Advanced?

Have you tried using the example.ods document I uploaded?
BTW: I am using Windows 10

No I didnt, but now (with disabled Java) I can confirm!

Dont use Scriptforge in general!

What do you mean?

It means, you dont need it (especially as python-programmer) because its just roundabout 30KLOC of boilerplate!

Then could you please tell me how would you write the same python code without Scriptforge??
I am not a professional programmer BTW, but I am willing to learn more.