dirname $(dirname $(readlink -f $(which java)))
openjdk version "11.0.22" 2024-01-16 OpenJDK Runtime Environment (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1) OpenJDK 64-Bit Server VM (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1, mixed mode, sharing) To see the exact JRE path: jre linux
For development or building code, install the instead. For running Java apps in production – especially headless servers – the JRE is exactly what you need. jre linux