I got the same error, but when I set my %JAVA_HOME% environment variable to C:\Program Files\Java\jdk-23, this fixed the problem (after restarting my command line).
%JAVA_HOME%
C:\Program Files\Java\jdk-23