I'm new to Java and are trying to run my first Java file. I can't get it to run.
When I go into cmd and type "javac MyFile.java" it creates a MyFile.class file next to it and when I try to run the file with "java MyFile" I get an error message: "MyFile has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 52.0".
I have tried to look for a solution on both stackoverflow and google and couldn't find a solution I understood. I think I have figured out that I need to have something called Java 12, and I currently have Java 8. When I search for Java 12 on google I can't find anything else than Java 8 (maybe I'm blind, but I can't find it). I have found Java JDK 12.0.2 but I also have that installed and it doesnt seem to work either so I guess its not the same as Java 12. And yes, I have them listed in the system PATH variables.
Where/how can I get Java 12?
(I just want to say again that this is my first time using Java to code so I have no idea how any of this works)
Edit:
java -version (in cmd): "1.8.0_221"
javac -version (in cmd): "12.0.2"
Path variable: "C:\Program Files\Java\jdk-12.0.2\bin"
JAVA_HOME variable: "C:\Program Files\Java\jdk-12.0.2"