I am Currently running VSCode 1.85.0 and it seems that no matter what I do, VSCode refuses to run any Java code. I successfully installed the VScode Java coding pack from
code.visualstudio.com/docs/languages/java
I also downloaded all of the Java extensions that were recommended. However, when I search Java: Create Java Project, nothing pops up. When I try to run
public class QuickStart{
public static void main(final String[] args) {
System.out.println("Hello World!");
}
}
Nothing happens. When I run this same code from the command line directly, it runs without issue. When I type in Java –version in the command line I get
openjdk 17.0.9 2023-10-17
OpenJDK Runtime Environment Temurin-17.0.9+9 (build 17.0.9+9) OpenJDK
64-Bit Server VM Temurin-17.0.9+9 (build 17.0.9+9, mixed mode,
sharing)
So it appears Java has been installed correctly but VSCode is unaffected and does not recognize it. I’ve tried manually deleting all of the extensions and reinstalling them but that also did not work. I am at a total loss. It seems like installing the extensions effectively does nothing. Is there anything else I can try?
2
Answers
(Solution 1/2). It is possible that you have not yet set the JAVA_Home environment variable yet.
(Windows)
(Solution 2/2). configure your "java.home" path in your settings.json file
Provide below is how to do so
Changing the java.home path in VS code
If neither of these solutions work, please reply.
Set the JDK path below and use Java to extend the execution script.
https://code.visualstudio.com/docs/java/java-project#_configure-runtime-for-projects