It seems that you are missing Java environment variable to make your program work.

What you can try:

Solution 1

Try to run caver_analyst with the --jdkhome switch, followed by (I guess) the path to a valid JDK as suggested in your error message. It should solve your problem.

Solution 2

Usually, the path to Java must be defined in a JAVA_HOME environment variable. Yours is obviously not defined, so let's define it manually :

  1. Open a Terminal
  2. Go to your home directory with command cd
  3. Look for a file called ".zshrc" in this directory:
you@yourmac ~ % ls .zshrc
.zshrc
  1. If it does not exist i.e. if the command ls .zshrc gives you a "No such file or directory" message, create the file: touch .zshrc
  2. Get the path to Java and keep it somewhere : which java
  3. Open the newly created file (it's a hidden file so you will have to show hidden files. Alternatively, you can edit the file in command line with nano .zshrc)
  4. At the end of the file, add the following line : export JAVA_HOME="/Path/to/your/java/home" and replace /Path/to/your/java/home with the path that you got at step 5.
  5. Save, close the file, reboot your laptop.

This file will be automatically read and its instructions executed when you open your profile. The "export" instruction creates an environment variable. You can verify if it was successfully created with echo $JAVA_HOME, echo being a command to display something. The "$" in front of the variable tells echo to look for a variable.

I hope this helps, but if it doesn't, please don't hesitate to share the error messages and step where it fails here...

Answer from Flow on Stack Exchange
Top answer
1 of 5
5

It seems that you are missing Java environment variable to make your program work.

What you can try:

Solution 1

Try to run caver_analyst with the --jdkhome switch, followed by (I guess) the path to a valid JDK as suggested in your error message. It should solve your problem.

Solution 2

Usually, the path to Java must be defined in a JAVA_HOME environment variable. Yours is obviously not defined, so let's define it manually :

  1. Open a Terminal
  2. Go to your home directory with command cd
  3. Look for a file called ".zshrc" in this directory:
you@yourmac ~ % ls .zshrc
.zshrc
  1. If it does not exist i.e. if the command ls .zshrc gives you a "No such file or directory" message, create the file: touch .zshrc
  2. Get the path to Java and keep it somewhere : which java
  3. Open the newly created file (it's a hidden file so you will have to show hidden files. Alternatively, you can edit the file in command line with nano .zshrc)
  4. At the end of the file, add the following line : export JAVA_HOME="/Path/to/your/java/home" and replace /Path/to/your/java/home with the path that you got at step 5.
  5. Save, close the file, reboot your laptop.

This file will be automatically read and its instructions executed when you open your profile. The "export" instruction creates an environment variable. You can verify if it was successfully created with echo $JAVA_HOME, echo being a command to display something. The "$" in front of the variable tells echo to look for a variable.

I hope this helps, but if it doesn't, please don't hesitate to share the error messages and step where it fails here...

2 of 5
5

I had to

  • Install Java 8, eg
brew install --cask adoptopenjdk/openjdk/adoptopenjdk8
  • add $JAVA_HOME to my ~/.zshrc
export JAVA_HOME='/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home'
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
  • remove any other jdk installs
ls /Library/Java/JavaVirtualMachines
sudo rm -rf NONJDK8.jdk

The 3rd bit is important! It did not work until I removed other-versioned jdks.

Top answer
1 of 16
255

You have to install the full JDK, not only the JRE.

I had the same issue and solved by installing JDK.

Please use this link to download the latest JDK version 22.

2 of 16
210

After installing openjdk with brew and runnning brew info openjdk I got this:

==> openjdk: stable 21 (bottled) [keg-only]
Development kit for the Java programming language
https://openjdk.java.net/
/opt/homebrew/Cellar/openjdk/21 (600 files, 331MB)
  Poured from bottle using the formulae.brew.sh API on 2023-09-26 at 11:06:55
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/o/openjdk.rb
License: GPL-2.0-only with Classpath-exception-2.0
==> Dependencies
Build: autoconf ✔, pkg-config ✔
Required: giflib ✔, harfbuzz ✔, jpeg-turbo ✔, libpng ✔, little-cms2 ✔
==> Requirements
Build: Xcode (on macOS) ✘
Required: macOS >= 10.15 (or Linux) ✔
==> Caveats
For the system Java wrappers to find this JDK, symlink it with
  sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

openjdk is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides similar software and installing this software in
parallel can cause all kinds of trouble.

If you need to have openjdk first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc

For compilers to find openjdk you may need to set:
  export CPPFLAGS="-I/opt/homebrew/opt/openjdk/include"

And from that I got this command here, and after running it I got Java working

sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
Discussions

(arm silicon) Unable to load java runtime environment? Why? | MacRumors Forums
Hello guys! I am trying to run this software from the Turkish government on a 2024 macbook MacOS sonoma with arm silicon processor. It worked perfect on a old 2014 mbp big sur intel. But get this error on the new macbook: "UNABLE TO LOAD JAVA RUNTIME ENVIRONMENT" Screenshot: More on forums.macrumors.com
🌐 forums.macrumors.com
April 17, 2024
Unable to load Java Runtime Environment
The application (installed either via HomeBrew, or from a direct download/install of DMG) on macOS High Sierra won't start. It displays a dialog with the message "Unable to load Java Runtime Environment". More on github.com
🌐 github.com
31
October 5, 2018
Unable to load Java Runtime Environment - Apple Community
I'm trying to use UniFi Controller on my MacBook Air running Big Sur, but I keep getting the error "Unable to load Java Environment". More on discussions.apple.com
🌐 discussions.apple.com
January 13, 2021
Unable to Load Java Runtime Environment on Mac - Ask Different
I have looked all over for an answer to this, but couldn't find anything helpful. Everything was working fine until I decided to migrate from Oracle's Java to BellSoft Liberica because of better su... More on apple.stackexchange.com
🌐 apple.stackexchange.com
May 15, 2025
🌐
Oracle
java.com › en › download › help › java_mac.html
Installing and using Oracle Java on macOS
Why is Oracle Java available only for Mac OS X 10.7.3 and above? The Java Runtime depends on the availability of an Application Programming Interface (API). Some of the APIs were added in Mac OS X 10.7.3.
🌐
MacRumors
forums.macrumors.com › software › mac apps
(arm silicon) Unable to load java runtime environment? Why? | MacRumors Forums
April 17, 2024 - The Uyap Doküman Editörü app works if you install the Intel version of Java (macOS x64 jre-8u411-macosx-x64.dmg), tested on Sonoma 14.4.1 (23E224) MBA M1 If you are afraid of zip files, disable “Open ‘safe’ files after downloading” and check their signature.
🌐
GitHub
github.com › kaikramer › keystore-explorer › issues › 144
Unable to load Java Runtime Environment · Issue #144 · kaikramer/keystore-explorer
October 5, 2018 - The application (installed either via HomeBrew, or from a direct download/install of DMG) on macOS High Sierra won't start. It displays a dialog with the message "Unable to load Java Runtime Environment". Running the kse.jar with java -j...
Author   kaikramer
🌐
Apple Community
discussions.apple.com › thread › 252309699
Unable to load Java Runtime Environment - Apple Community
January 13, 2021 - I'm trying to use UniFi Controller on my MacBook Air running Big Sur, but I keep getting the error "Unable to load Java Environment".
🌐
Stack Exchange
apple.stackexchange.com › questions › 479988 › unable-to-load-java-runtime-environment-on-mac
Unable to Load Java Runtime Environment on Mac - Ask Different
May 15, 2025 - java -version results in openjdk version "1.8.0_452" OpenJDK Runtime Environment (build 1.8.0_452-b11) OpenJDK 64-Bit Server VM (build 25.452-b11, mixed mode) IntelliJ works fine, and java -jar abc.jar works fine. But if I double-click a java *.app (which worked fine before), I get the message in the subject line. I am running MacOS 15.4.1 on Mac (Intel).
Find elsewhere
🌐
Mac Install Guide
mac.install.guide › java › unable-to-locate
Fix "Unable to Locate a Java Runtime" - Mac Install Guide
The Java compiler (javac) is included ... works but javac doesn't: ... Cause: You may have a JRE instead of a full JDK, or PATH points to /usr/bin/java (the macOS stub) rather than a real JDK....
🌐
GitHub
github.com › processing › processing4 › issues › 526
Export Application displays "Unable to load Java Runtime Environment" on Apple Silicon M1 · Issue #526 · processing/processing4
August 3, 2022 - Issue Description: Export Application displays "Unable to load Java Runtime Environment" error after attempting to run application The Fix/Solution: Show package contents and navigate to contents/macOS, launch app and will run successfully Step ...
Author   processing
🌐
Apple Developer
developer.apple.com › forums › thread › 687489
Java Runtime not found | Apple Developer Forums
Either a path issue or another issue with the JDK install. This could potentially be fixed by simply updating your Java path in your terminals profile (.profile, .bash_profile, .zshrc, etc). i.e Make sure JAVA_HOME environment variable is set to the JDK’s folder.
🌐
Apple Community
discussions.apple.com › thread › 255037004
"Unable to Load Jawa Runtime Environment"… - Apple Community
August 2, 2023 - When checking for the java version: Diana_A@Dianas-MacBook-Pro-4 ~ % java -version openjdk version "17.0.4.1" 2022-08-12 OpenJDK Runtime Environment Temurin-17.0.4.1+1 (build 17.0.4.1+1) OpenJDK 64-Bit Server VM Temurin-17.0.4.1+1 (build 17.0.4.1+1, mixed mode, sharing) I'm not very knowledgable on Java, but this .jar application has worked for other computers by just downloading Java and opening the file.
🌐
Processing Forum
forum.processing.org › two › discussion › 23972 › export-for-mac-unable-to-load-java-runtime-environment.html
Export for Mac / Unable to load Java Runtime Environment - Processing 2.x and 3.x Forum
@globby=== i work with P3 && Sierra and the export is ok; i have installed java 1.8 and set the preferences security to authorize apps. ... hey @akenaton, thanks for your quick reply! the export does work fine on my mac as well but when i open it on a mac with no java installed the error message appears (although i embedded java in the export).
🌐
Stack Overflow
stackoverflow.com › questions › 79622468 › unable-to-load-java-runtime-environment-on-mac
macos - Unable to Load Java Runtime Environment on Mac - Stack Overflow
java -version results in openjdk version "1.8.0_452" OpenJDK Runtime Environment (build 1.8.0_452-b11) OpenJDK 64-Bit Server VM (build 25.452-b11, mixed mode) IntelliJ works fine, and java -jar abc.jar works fine. But if I double-click a java *.app (which worked fine before), I get the message in the subject line. I am running MacOS 15.4.1 on Mac (Intel).
🌐
Keyboard Maestro
forum.keyboardmaestro.com › questions & suggestions
Unable to Load the Java Runtime Environment - Questions & Suggestions - Keyboard Maestro Discourse
April 12, 2022 - On my old iMac I used a Keyboard Maestro macro to open Moneydance.app, then hide or bring it to front as appropriate. I used Migration Assistant to move everything from the iMac with MacOS 11.6.5 (Big Sur) to a Mac Studio with MacOS 12.3 (Monterey). On the Mac Studio now, the same Macro produces an error dialog saying "Unable to load Java Runtime Environment" and does not open Moneydance.
🌐
GitHub
github.com › UniversalMediaServer › UniversalMediaServer › issues › 5231
macOS 10.15.7 "Unable to load Java Runtime Environment" · Issue #5231 · UniversalMediaServer/UniversalMediaServer
January 6, 2025 - Universal Media Server 14.8.0 Doesn't start at all. Error pop-up "Unable to load Java Runtime Environment" Java runtime: 1.8 | 1.8.0_431 | http://java.sun.com/products/autodl/j2se | /Library/Internet Plug-Ins/ While 14.6.0 is running per...
Author   UniversalMediaServer
🌐
Apple Community
discussions.apple.com › thread › 251341052
Unable to load java runtime environment (… - Apple Community
May 6, 2020 - Whenever I try to start up OSRS (a game run by java) it says unable to load java runtime envrionment. So I took it upon myself to try to download the latest version of java for this Mac. Although once again I ran into another issue. It said Java cannot be ran due to suspicion of malicious hardware ...
🌐
Apple Community
discussions.apple.com › thread › 255607439
Unable to load Java Runtime Environment o… - Apple Community
May 9, 2024 - OK, I’ve done some further testing. If I double-click the .app file, I get the error message "Unable to load Java Runtime Environment”. However, if I go to the package contents and open the .jar file (right click and select JavaLauncher.app, it opens fine.
🌐
YouTube
youtube.com › watch
HOW TO FIX "Unable to locate a Java runtime" ERROR ON MAC! | Tutorial - YouTube
Hey y'all! So I've been getting a lot of comments saying that they can't open .jar files because their computer can't locate a Java runtime, so I decided to ...
Published   June 28, 2022