java.lang.UnsupportedClassVersionError when trying to run a Java scratch.
Answered
When try to run a scratch with the following code:
class Scratch {
public static void main(String[] args) {
System.out.println("Helllo world");
}
}
I get the following output in the console.
Error: LinkageError occurred while loading main class Scratch
java.lang.UnsupportedClassVersionError: Preview features are not enabled for Scratch (class file version 55.65535). Try running with '--enable-preview'
Process finished with exit code 1
Any idea how to solve this?
Please sign in to leave a comment.
Please try switching to JDK10
Seems to be some kind of misconfiguration.
- the compilation was invoked with
- then the execution must be
- if you call it only as
then you get
For me the preview feature (JEP 12 http://openjdk.java.net/jeps/12 ) is working as intended. Check in your settings where you specify the option `--enable-preview` for the compilation.