Reputation: 81
When i run my HelloWorld, it returns:
"java.lang.UnsupportedClassVersionError: HelloWorld has been compiled by a more recent version of the Java Runtime (class file version 52.65535), this version of the Java Runtime only recognizes class file versions up to 52.0 "
How do I solve this problem?
public class HelloWorld{
public static void main(String[] args) {
System.out.println("123");
}
}
Upvotes: 8
Views: 11795
Reputation: 1
It's work for me (I'm using Windows).
Upvotes: 0
Reputation: 25
My situation is version conflict between java and javac on Ubuntu;
just run this code:
sudo update-alternatives --config javac
Upvotes: -2
Reputation: 61
The issue is connected with Java Debugger extension. I had the same problem and it has been logged in issue log: https://github.com/Microsoft/vscode-java-debug/issues/555
Problem is only with single file applications like HelloWorld. It is ok if you run maven project.
Medsonk's instruction worked for me: https://github.com/Microsoft/vscode-java-debug/issues/555#issuecomment-478464496
summary:
1. make sure uninstall jdk8 clean
2. install jdk11
3. add "vmArgs": "--enable-preview" in launch.json
4. F1, "Java: Clean ……" and "Java: Force ……"
5. run standalone file again
Upvotes: 6