Create new custom variable that point to the preferred version

Set %JAVA_HOME%/bin as first entry to Path Variable

Profit!
Check with
java -version
Why not just remove the Oracle Java path entry and not worry about your JAVA_HOME placement in the Path?
You might suggest to simply remove the Oracle Java path that was prepended to your Windows PATH by the installer. Yes, I thought of that too, but the installer also copies the java.exe, javaw.exe, and javaws.exe files to C:\Windows\System32 directory, which is also in the Windows PATH variable. So rather than chase down all the possible directories that the installer put Java, and to avoid deleting the System32 files that actually may be necessary to some process somewhere, I decided that simply prepending my preferred Java Home directory to the path was best option.
Source: How to set custom Java path after installing JDK 8 โ Douglas C. Ayers
Answer from Ooker on Stack OverflowCreate new custom variable that point to the preferred version

Set %JAVA_HOME%/bin as first entry to Path Variable

Profit!
Check with
java -version
Why not just remove the Oracle Java path entry and not worry about your JAVA_HOME placement in the Path?
You might suggest to simply remove the Oracle Java path that was prepended to your Windows PATH by the installer. Yes, I thought of that too, but the installer also copies the java.exe, javaw.exe, and javaws.exe files to C:\Windows\System32 directory, which is also in the Windows PATH variable. So rather than chase down all the possible directories that the installer put Java, and to avoid deleting the System32 files that actually may be necessary to some process somewhere, I decided that simply prepending my preferred Java Home directory to the path was best option.
Source: How to set custom Java path after installing JDK 8 โ Douglas C. Ayers
For linux users run command sudo update-alternatives --config java
it will return the list of java JDKs you have and you can simply use its index to select your preferred version
How do I downgrade to openjdk 11?
How do I change my Java version from 17 to 8?
How do I downgrade JDK?
How to downgrade Java in Debian?
Videos
The title says it all. I have a software (Apache spark) that runs on Java 8/11, but my system runs on Java 17. So I need to downgrade.
Which also arises a second question. If i run that program as second user will it only modify these settings in that user or all globally?
I downloaded Prism Launcher because I wanna play beta 1.7.3 but it wonโt let me because iโm on Java 17
I installed JDK with the Ubuntu Software application which selected JDK-16.0.2, and I need to downgrade to version 11.