I installed the Windows Subsystem for Linux on my Windows 10 machine. I am trying to do all my salesforce development in WSL so I can rely on the Linux CLI in my integrated terminal in VSCode. To do that I installed the Remote Development Extension Pack and I installed the Salesforce Extension Pack in WSL.

Whenever I open an sfdx project in WSL, I get the error message: "Java runtime could not be located. Set one using the salesforcedx-vscode-apex.java.home VS Code setting. For more information, go to Set Your Java Version.

Source: Apex (Extension)"

I set my JAVA_HOME to /mnt/d/Program Files/Java/jdk-11.0.3 in WSL because when I run whereis java one of the results I get is /mnt/d/Program Files/Java/jdk-11.0.3/bin/java.dll. I also added {%JAVA_HOME}/bin to my path in WSL.

I have tried every variation I could think of when trying to set the salesforcedx-vscode-apex.java.home variable in my settings, including both the windows and linux paths to jdk-11.0.3.

1 Answer 1


I got this to work on my box.. here is what I did.

First run this command to install openjdk 8

sudo apt install openjdk-8-jdk

If you have multiple versions of java installed run the command below and choose whatever entry is java 8. ALSO, copy the path associated with java 8.

sudo update-alternatives --config java

Here is a Screenshot to help you :)

Then run: sudo nano /etc/environment and add this line (or edit it if it exists):


Finally, add this to your settings.json file in VSCode

"salesforcedx-vscode-apex.java.home": "(YOUR PATH TO JAVA HERE, should be something like what you see in the image above)"

That should do it! Let me know if you have any questions!

  • Fixed it for me! Learned a couple of things. Thanks 🙏 Nov 18, 2019 at 22:43

You must log in to answer this question.

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