The error you are encountering typically occurs due to a mismatch between the version of Java used to compile your classes and the version used to run them.:
First, verify the version of Java installed on your system. Run the following command to check the version: java -version
Ensure that the version displayed is compatible with the Java version used for compiling your code. If there's a mismatch, you may need to recompile your classes with the correct version.
You can specify the source and target versions during compilation using the javac command. For example, to compile with Java 11, use: javac -source 11 -target 11 YourClass.java
This will ensure that both the source code and the generated bytecode are compatible with Java 11.