'javac' is not recognized as an internal or external command, operable program or batch file. in VS Code, using Code Runner extension

16,253

Assume you are on the Windows System.

First, you might want to add your jdk path to window system environment.

point jdk path to system environment

Then, open your VS Code, and go to User Settings located under File -> Preferences -> User Settings.

Add jdk PATH in your VS Code as the following shows.

point jdk PATH in VS Code

Important Step: after all above steps are done, you might want to restart the VS Code to let change go in effect.

To test if it works, open Integrated Terminal in VS Code under View (or type Ctrl + ` (this key is located next to number 1) Once the terminal shows up and is initialized, type javac to verify VS Code recognize the command.

Share:
16,253
Mocoma
Author by

Mocoma

Updated on June 23, 2022

Comments

  • Mocoma
    Mocoma about 2 years

    I am trying to run some java code in VS Code with the Code Runner extension, but i keep getting this:

    'javac' is not recognized as an internal or external command,
    

    operable program or batch file.

    I checked all the paths and updated the path in VS Code, but it did nothing.

  • Jörg
    Jörg over 6 years
    I have many different projects on my computer and each requires its own JDK version. I do not want to pollute my system path to get an IDE working. There has to be a property in settings.json to point to the JDK or even better one would expect that if java.home points to a valid JDK that VS Code can find javac on its own.
  • Aviroxi
    Aviroxi about 3 years
    i am not able to find the workspace settings in vscode
  • leoflower
    leoflower about 3 years
    @gurukiranx can you please try with this link User and Workspace Settings