About vscode "Error: LinkageError while loading main class Main"

Asked 2 years ago, Updated 2 years ago, 78 views

I'm a beginner in programming.
When I wrote the code in vscode and debugged it with F5, the following error occurred in the debug console:

Error: LinkageError loading main class

java.lang.UnsupportedClassVersionError: Preview features are not enabled for Main (class file version 56.65535).Try running with '--enable-preview'

Here's the code.

public class Main {
    public static void main(String[]args) {
      System.out.print("Hello World");
    }
}

It was done normally until just a while ago, but I suddenly put it down.
I tried reinstalling vscode and reinstalling the latest 12 JDKs, but the problem still persists.

The language is java.
The operating system is Windows 10.
JDK is 12.

I would appreciate it if you could give me an answer.
These are the images in question and launch.json images.
Enter a description of the image here
Enter a description of the image here

java vscode

2022-09-30 21:38

2 Answers

Probably This is .Try opening launch.json and vmArgs with --enable-preview.

[Reference]
Debugging Java in Visual Studio Code


2022-09-30 21:38

Excuse me, I used user32753.I'm a beginner in stack overflow, and I tried to log in, but somehow I couldn't log in to 32753, so I was created a new account.
I am writing to let you know that the problem has been resolved.I erased all the files I had created, including visual studio code, and it was cured.I didn't know what caused this problem.Thank you all for your cooperation despite your busy schedule.


2022-09-30 21:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.