Cant help you but i have exactly that error rn. I tried to make a forge server for 1.21.1 and in the run.bat i get that error.
Edit: Actually I CAN help you because i just found the solution myself.
Here just install a newer version of java: https://www.oracle.com/de/java/technologies/downloads/#jdk24-windows
No need to uninstall anything. I just took the #64 Installer and run it, it installed and now i have no problems anymore. I hope it works for u too man.