I just downloaded vscode and I’m new to coding. I installed the extensions for java online before downloading vscode itself. I made a project and created a file inside. Visual studio code won’t let me run or debug. It just keeps giving me the same exact error every single time. I already have a JDK downloaded, but it keeps giving me the error. I don’t really understand what is wrong. Could someone please help me? Here are the images of the 2 errors I get:
(https://phpout.com/wp-content/uploads/2023/10/YPJVQ.png)
(https://phpout.com/wp-content/uploads/2023/10/wgo5q.png)
I deleted and reinstalled the red hat JDK many times, but it won’t work. I’m not sure if there is a step I’m missing out or something. I also deleted and reinstalled vscode to try to get it to work, but no luck. I looked at other forums, but I don’t understand what they are saying.
2
Answers
Have you set the jdk path in environment variables? If not then follow the steps below:
Search result image
Environment variables image
Now you can retry running your program and maybe restart vscode and try again if it doesn’t work.
Hope it helps, Happy coding 🙂
Check out this link to learn more about using Java in vscode.
This setting can specify JDK 17 and above versions to activate the Java language server.