How to fix JRELoadError on macOS 10.15.4 Catalina? When I download or brew-cask-install JOSM, jEdit (and propably any other java app) and run it, I get JRELoadError.

I have:

$ java -version
openjdk version "14" 2020-03-17
OpenJDK Runtime Environment (build 14+36-1461)
OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)


How to fix that error?
Solved by installing Java 8u241 from java.com instead of Homebrew.