It seems that the JAVA_HOME path you set is not matching the actual folder name where Java is installed.
Make sure that your JAVA_HOME points exactly to the jdk-24 folder (not jdk-24.0.1 or anything else).
Setting the correct path should solve the issue.
After updating the path, restart your terminal and try building again