I want to see the list of all jdk versions available in my system. However, when I type in java and javac version to the cmd line, it gives me only jdk 20 version. How can I do an implementation to see other jdk versions as well in the list?
C:\Users\USER>java --version
java 20 2023-03-21
Java(TM) SE Runtime Environment (build 20+36-2344)
Java HotSpot(TM) 64-Bit Server VM (build 20+36-2344, mixed mode, sharing)
C:\Users\USER>javac --version
javac 20
C:\Users\USER>
I just typed java --version and javac --version commands to see jdk versions exist in my computer. Due to my assignment, I need jdk8 version. How can solve the problem in order to see the version I need?
You're going to have big headaches if you try to handle multiple java versions manually. The best option is to delegate this to a third party tool, quite some already exists to overcome the issue. The best one and recommended by several frameworks (https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#getting-started.installing.cli.sdkman) is sdkman:
https://sdkman.io/
Follow windows installation: https://sdkman.io/install#:~:text=Windows%20installation
Then do:
You will see something like:
Install what you need with:
Then switch among versions with: