Have reinstalled Windows for my laptop and reinstalled Visual Studio Code, JDK as well. But am facing a debugger(?) problem.
Everytime when I'm trying to compile/debug Java file outside of Maven getting this exception (even if this is empty class with simple console output "Hello world" written by me I get this error. Trying to compile/debug using Java Extension Pack: :
java.lang.UnsupportedClassVersionError: NameOfMyClass 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
- JDK version is 1.8.0 201
- VS Code 1.32.3
- JAVA_HOME variable is set to right path "C:\Program Files\Java\jdk1.8.0_201"
Any ideas, please?
Answer
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
No comments:
Post a Comment