How does LO find installed Java JDK?

On a Mac with Apple Silicon processor, how — specifically — does LO find available JDKs? What file(s) does it look for, and where does it look for the installed JDK?

I installed Oracle JDK 17 and LibreOffice 7.5.2.2 (Intel…I did not find an Apple ARM version of LO 7.5.x) on my brand-new M2 MacBook Pro, which is running macOS Ventura 13.0.

Java reports its version:
% java -version
java version “17.0.6” 2023-01-17 LTS
Java™ SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot™ 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)

and its Home directory:
% /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home

LO reports its version:
Version: 7.5.2.2 (X86_64) / LibreOffice Community
Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2
CPU threads: 12; OS: Mac OS X 13.0; UI render: default; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

However, when I try to open a database Base reports:
LibreOffice requires Oracle’s Java Development Kit (JDK) on macOS 10.10 or greater to perform this task…
The connection to the data source “database-name” could not be established.
No Java installation could be found. Please check your installation.

In LibreOffice > Preferences > Advanced, the list of “Java runtime environments (JRE) already installed” is empty.

How do I make Base find the installed JDK so that I can open my database?

There are so many people reporting problems with Mac/Java/LibreOffice. Have a look here:

You could use Firebird instead, but ReportBuilder won’t work, also wizards for Base won’t work…

Do you mean that both JDK and LO are Intel?

Hmm.

1 Like

Answering directly: it happens here. It checks JAVA_HOME, PATH, and then scans some pre-defined directories. For every checked path, it calls getAndAddJREInfoByPath, where the most of job is done inside getJREInfoByPath.

1 Like

Problem solved!

I had installed Apple Silicon version of JDK 17.0.6, but had installed Intel version of LO for Mac. Using AppCleaner (https://freemacsoft.net/appcleaner/), I deleted LO (Intel). I then downloaded and installed LO (Apple Silicon) for macOS.

LibreOffice > Settings > Advanced now shows that Oracle Corporation JRE 17.0.6 is installed. Base now opens and displays my database, reports, and queries just as it did on my old iMac.