skip to Main Content

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?

2

Answers


  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.

    Login or Signup to reply.
  2. You can find where your Java installation lives with this command:

    $ readlink -f $(which java)
    

    On my Fedora Linux workstation it results in:

    /usr/lib/jvm/java-11-openjdk-11.0.13.0.8-2.fc35.x86_64/bin/java
    

    So the directory is /usr/lib/jvm/java-11-openjdk-11.0.13.0.8-2.fc35.x86_64

    However you will notice that directory has a very specific version in the path. This is undesirable because it will change when java is updated and might break your Eclipse configuration.

    But good news: When I look in my /usr/lib/jvm directory there is a versionless symlink on my system which points (eventually) to the same place: /usr/lib/jvm/java-11-openjdk

    I would use the versionless symlink because then my Eclipse configuration will not break when java gets updated. Hopefully it is similar on Debian.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search