If I open the command prompt, go to my application folder and type the following:
java -version
I'll get the following result:
java version "11.0.8" 2020-07-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.8+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode)
But if I go to Spring Tool Suite > right click project name on Project Explorer > Show in > Terminal > and type the same command (in the exact same folder as above):
java -version
I get a different result:
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-46)
OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode)
How can it be?
Result when typing echo %PATH%
in the command line:
C:\Program Files\Java\jdk-11.0.8;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Oberthur Technologies\AWP\Dlls;C:\Program Files\Oberthur Technologies\AWP\Dlls;C:\Program Files\Git\cmd;C:\Program Files\Java\jdk-11.0.8\bin;C:\Program Files\apache-maven-3.6.3\bin;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\Samsung\AppData\Local\Microsoft\WindowsApps;C:\Program Files\heroku\bin
Result when typing echo %PATH%
in the STS terminal (same folder as above):
C:/spring-tool-suite-4-4.8.0/contents/sts-4.8.0.RELEASE//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.
win32.x86_64_14.0.2.v20200815-0932/jre/bin/server;C:/spring-tool-suite-4-4.8.0/contents/sts-4.8.0.RELEASE//p
lugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_14.0.2.v20200815-0932/jre/bin;C:\Program File
s\Java\jdk-11.0.8;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Ora
cle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerSh
ell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Oberthur Technologies\AWP\Dlls;C:\Program File
s\Oberthur Technologies\AWP\Dlls;C:\Program Files\Git\cmd;C:\Program Files\Java\jdk-11.0.8\bin;C:\Program Fi
les\apache-maven-3.6.3\bin;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\Samsung\AppData\Local\Micros
oft\WindowsApps;C:\Program Files\heroku\bin;C:\spring-tool-suite-4-4.8.0\contents\sts-4.8.0.RELEASE;