Search code examples
javaadoptopenjdk

How do I configure the "Eclipse Temurin JDK with Hotspot" in VS Code after installation by the "coding pack for java"?


I tried installing the JAVA JDK on my laptop, provided by the installer on VS Code website as a "Coding pack for Java". It installed the JDK and the required extensions in VS Code. But then inside the editor, it didn't configure the JDK by itself. So I tried doing it manually and then I found that there is no "JDK" folder in the "Program Files" folder in C-drive. I tried to find everywhere inside that folder about the JDK, searched online at many places, and reinstalled it several times but still, nothing worked. I can't address the error. Please reach out to me if anyone knows the fix for it.

The following java version I tried to install:

OpenJDK version "17.0.2" 2022-01-18 OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8) OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)

Operating system and platform: OS - Windows 10 pro 21H2 on x64 Platform - V.S.Code

[VS Code can't configure the JDK][1] [1]: https://i.sstatic.net/VU0HH.png


Solution

  • There could be a few reasons why this is happening.

    You can check installed Java versions and view their locations by using Registry Editor. There are a few possible keys to check, depending on what JDKs you have installed.

    1. Standard Java -> HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft
    2. Eclipse Foundation -> HKEY_LOCAL_MACHINE\SOFTWARE\Eclipse Foundation
    3. Eclipse Adoptium -> HKEY_LOCAL_MACHINE\SOFTWARE\Eclipse Adoptium

    If you want to check using Windows Explorer, some common locations include C:\Program Files\Java, C:\Program Files\Eclipse Foundation, and C:\Program Files\Eclipse Adoptium

    If you installed using VS Code's Java helper, then it most likely installed Eclipse Adoptium.

    Lastly, you need to make sure that Java is added to your system's PATH environment variable, along with JAVA_HOME (here is how you can do that).

    Note that you will need to know the locations of your installed JDK and JRE. That is why I listed how to find said items first.

    Hope this helps!