'Cant find Java VM to add in Eclipse

I am following a tutorial to learn Java and it uses Eclipse. When starting a new Java project in the Eclipse IDE, after adding the project name the tutorial goes to Configure JREs->Add...->Standard VM and then browses to a folder which seems to be the VM home. However, in the tutorial when the browse window opens, it already opens in a directory which contains all VM folders, named jdk-14, jdk-15, etc.. I cannot by any means find any similar JVM folder in my computer, although I'm pretty sure I have Java installed.

I'm running in a Debian 11. if I run

java -version

I get

java version "17.0.2" 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86) Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)

Any suggestions on where to look for folders named like jdk-xxx.xx to add to Eclipse?



Solution 1:[1]

For Linux try command: readlink -f $(which java)

If you are in Windows try these steps

Open command prompt and execute c:\> for %i in (java.exe) do @echo. %~$PATH:i

This should print the path of your jdk.

Alternatively if java path is defined try where java in command prompt.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1