Rush Build failed with internal error

I am new to extension dev. I have installed rush and created a new project. When I try to run “rush build” command it gives this error.

Compilation failed with an internal error.
java.lang.IllegalArgumentException: Unsupported class file major version 62

Make sure that the JAVA_HOME environment variable points to JDK 8 installation. Rush doesn’t supports JDKs other than version 8.

Thanks for your reply.
I was trying it on java 18.0.1