In this demonstration I will upgrade Java (which was installed on Rocky Linux) from Java-11 to Java-17 manually.
In below screenshot a Linux machine with Rocky Linux with Java-11 installed is shown below.
Download tar file for java-17 and unarchive it.
Change JAVA_HOME and PATH in /etc/profile file as shown in screenshot below.
Now check PATH, JAVA_HOME and java -version as shown in the screenshot below.
You can see the java version is not changed and remain java-11. To select the java version as java-17 follow the below steps.
You can cross verify this, the select java version is java-17 using the command shown below.