You are not installing the java version. You are looking for environment variables $PATH
(bash) and %PATH%
(Windows / DOS / cmd.exe). When you run the java -version
, the shell looks for directories on $PATH
to find the java
program and starts it with the given arguments. If you get different results in different shells, it means that you have different PATH, so another Java installation will be found.
source share