Cannot find java error - bigsur M1

Unable to run autopsy, get an error “Cannot find java. Please use the --jdkhome switch” .
This is what I see:

> echo $JAVA_HOME
> /Library/Java/JavaVirtualMachines/liberica-jdk-8-full.jdk/Contents/Home
> java -version
> openjdk version "1.8.0_292"
> OpenJDK Runtime Environment (build 1.8.0_292-b10)
> OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
>  ls /usr/local/share/java/
> sleuthkit-4.10.2.jar		sleuthkit-caseuco-4.10.2.jar
> ./autopsy
> The operation couldn’t be completed. Unable to locate a Java Runtime that supports (null).
> Please visit http://www.java.com for information on installing Java.
> 
> Cannot find java. Please use the --jdkhome switch.
>  pwd
> /Users/<redacted>/Downloads/autopsy-4.18.0/bin

What can I do to fix this? I’m running on bigsur mac (M1) and followed https://slo-sleuth.github.io/tools/InstallingAutopsyOnMacOS.html to install.

I had the same problem, but after reading the launch script, I figured out what was wrong.

In the installation guide, replace all instances of $JAVA_HOME with $jdkhome .

Or, what I found easier, just insert

jdkhome="$JAVA_HOME" in line 83 or earlier.