You need to update your java version. Try adoptium: https://adoptium.net/temurin/releases/?os=any&arch=any&version=21
Scroll down to windows if that's what you're using. You'll probably want to choose the .msi file.
Technically all you should need is the JRE, but when I tried to select it from the dropdown it wasn't working and the JDK works fine too.
After you download the .msi file and start the installation wizard, make sure you select the options to add installation to path, set java home variable, and associate jar files with java.
Once you've done that, you should be able to run your .sh or .bat script and it should work fine.