As far as i know you can use every Java version when you are just in the right directory.
Lets say i have on my PC Java 8 and Java 15. They are both located in C:Program Filesjava
.
So when i go in C:Program Filesjavajre1.8.0_291bin
and run in cmd java.exe -version
i get the version 1.8 .
The same goes with Powershell.
But here comes the problem. When i go to C:Program Filesjavajdk-15.0.1bin
i get in cmd the version 1.15, but in Powershell i still get 1.8.
I think that Powershell always refers to the standard JRE installed.
Advertisement
Answer
You need to add .
before the command.
java.exe
will run the first java in your PATH.
.java.exe
will run the java.exe in your current directory.