When starting VS Code (v1.21.1) with the VS Code extensions installed (v40.4) I'm getting the error message:

Java runtime could not be located. Set one using the salesforcedx-vscode-apex.java.home VS Code setting.

It seems fairly clear that I need to configure the Java runtime against the IDE. How do I go about this?

4 Answers 4


There are explicit details on the steps required for this in How do I configure the version of Java that the Apex Language Server uses?

By default, VS Code attempts to locate your local Java installation by looking for a JAVA_HOME or JDK_HOME environment variable on your computer. If VS Code cannot find your Java installation, or if you want it to use a different installation, change the salesforcedx-vscode-apex.java.home setting.

enter image description here

Note that while the message specifies the JRE the prerequisites are currently for the JDK.

    "/Program Files/Java/jdk1.8.0_121"

Upon restarting code.exe wanted network access past the firewall.

The output window for the Apex Language Server also showed messages indicating it was running now.

enter image description here

  • I have tried the same but still getting the same error, could you please suggest?
    – gs650x
    May 6, 2019 at 13:23
  • 1
    @gs650x I'd check that you have the Java 8 SE JDK, that the path is correct, and that setting is correctly applied. Other than that you may need to ask a new question here or post the the SFDX success groups. May 6, 2019 at 19:55
  • 1
    Thank you so much for responding, the issue was due to the java version earlier I was using Java 12 and then I installed java 8
    – gs650x
    May 7, 2019 at 4:36
  • Found article about this: sfdchelper.com/…
    – Paul Boiko
    Aug 22, 2019 at 2:00
  • 1
    On mac this was my jdk path: "/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home" Jun 2, 2020 at 19:31

Not sure but you need java 8 specifically. Doesn't seem to work with Java 11. I ran into the problem and found that the required version is mentioned in these issues and comments on GitHub.
https://github.com/forcedotcom/salesforcedx-vscode/issues/100 https://github.com/forcedotcom/salesforcedx-vscode/issues/930

  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Jayant Das
    Mar 25, 2019 at 17:35
  • Sorry, and i did. Just wanted to point out java 8 vs java 11. Answer above is the answer, but it needed info on what version.
    – slopez15
    Mar 25, 2019 at 20:38
  • Nathan Totten just updated github.com/forcedotcom/salesforcedx-vscode/issues/930 stating JDK 11 is supported now. May 25, 2019 at 10:34
  • I am using jdk 11 and its working fine now after giving path in settings Aug 23, 2019 at 9:42

Go to Vs Code Setting left bottom corner

Vs Code Setting

Search Apex and look at second result.

Now go to My pc Java And copy directory

Installed java location

and Paste in Vs code Java Home.


On Windows:

Right-click on "This PC" or "My Computer" and select "Properties." Click on "Advanced system settings" on the left. In the System Properties window, click the "Environment Variables" button. Under "System Variables," click "New." Enter JAVA_HOME as the variable name. Set the variable value to the path of your Java installation directory (e.g., C:\Program Files\Java\jdk1.8.0_181). Click "OK" to save the changes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .