Which version of JDK are you using?
JDK 8 but jdk10 is also installed.
Can you check java home path and version from command prompt or terminal.
Make sure you have JDK8 not 10 to work with AEM.
Please update your pom.xml file with the JDK version you wanted to compile. This should fix the following issue.
10.0.2 is set now when I checked from terminal. Any way to change it?
where can I find the pom.xml file
Please check following configuration
and Set "auto" in Source VM and TargetVM , if not set.
The error seems to be most likely because of JDK version. Can you first set your jdk path and further run AME to check if that solves the problem.For eg : on windows go to folder where your AEM jar is located and set PATH=C:\Program Files\Java\jdk1.8.X.XX\bin
same error on that page