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.
Advertisement
Answer
Assume you are on the Windows System.
First, you might want to add your jdk path to window 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.
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.