I’ve been trying to install java on vs code for a couple hours now and I can’t seem to get it to work. I’ve already downloaded all the extensions necessary and I’ve downloaded the coding pack from https://code.visualstudio.com/docs/languages/java for windows (I’m on windows 11). According to multiple tutorials, this is all I should have to do, but when I make a test.java file, the "run java" does nothing and "run code" gives me an error.
and this is the output when I click that run button in the top right:
Does anybody have any suggestions? the coding pack was supposed to come with a jdk, its working for everybody else so I’m not sure what the issue is.
2
Answers
It seems like you don’t have correctly installed
java sdk
on your system.Try to check
java sdk
installation with following commands:In case you don’t see reasonable output, try to install
java sdk
,go to the Java Downloads section of the Oracle website, and download the Installer from there.
Are you sure you are following the documentation? It looks like you didn’t download the official Java extension pack, but used Code Runner to run the code.
Please download the Java extension package and use
Run Java
orRun
to run the code.Getting Started with Java in VS Code.