I just started learning Java and am using VS Code. For compiling and running the program I use the code runner extension and works perfectly fine for C++ and Python. But in Java the run button is not that of the extension's and the shortcut for the extension (Ctrl+Alt+N) returns an error. I have downloaded JDK version 16 from Oracle and the have included its path to the environment variables as well. The error it shows is:
Error: Could not find or load main class main
Caused by: java.lang.NoClassDefFoundError: Main (wrong name: main)
When running by doing javac main.java and java main, it works fine.. the problem is the extension is not working.
Any help would be appreciated.
Thanks in advance.