skip to Main Content

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.

code

and this is the output when I click that run button in the top right: output

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


  1. It seems like you don’t have correctly installed java sdk on your system.

    Try to check java sdk installation with following commands:

    java --version
    javac --version
    

    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.

    Login or Signup to reply.
  2. 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 or Run to run the code.

    enter image description here

    Getting Started with Java in VS Code.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search