I wrote a Hello world program in Java (JDK 13.1) in Notepad++ (7.8.1) and tried to run it on Windows Powershell. But it is showing me an error. How can I resolve this?
Asked
Active
Viewed 139 times
-4
-
1Are we suppose to guess the error ? Please edit your post and add code + error – azro Nov 16 '19 at 13:47
-
Code and error samples would be very helpful... – Kwame Opare Asiedu Nov 16 '19 at 13:56
-
You try to run a class file that has been compiled by Java 13 with Java 8. – Johannes Kuhn Nov 16 '19 at 14:13
-
2And please don't post images of the error. Please copy the error out of Powershell and [edit] your question to include it there. – Johannes Kuhn Nov 16 '19 at 14:14
1 Answers
0
Your screenshot (true, don't post pictures of text - post the text!) shows that your code was compiled in Java 13 (class file version 57) but is being run against Java 8 (supports up to v52).
This is likely a PATH
problem whereby the java
found by default is not the one you want. It is easy to prove by running java --version
You need to determine where your Java 13 is located, test with
"C:\Program Files\Java\jdk13\bin\java" --version
Ref: Java version > class file version mappings: https://en.wikipedia.org/wiki/Java_class_file#General_layout

Johannes Kuhn
- 14,778
- 4
- 49
- 73

drekbour
- 2,895
- 18
- 28
-
1If you look at the [previous revision](https://stackoverflow.com/revisions/58891364/1) of this question, not even the image was there. Just a "I have an error, please help ASAP". – Johannes Kuhn Nov 16 '19 at 14:24
-
That's really odd revision. @halfer made that change not OP, his quote is "Trim ASAP begging" but somehow the screencap appeared at the same time as if _he_ added it. I think SO is being a little buggy here? – drekbour Nov 16 '19 at 14:30
-
There was a link to the image in the source code. New users can't post questions with images, so it was left out. Try to look at the [revisions](https://stackoverflow.com/posts/58891364/revisions), specifically, side-by-side markdown. – Johannes Kuhn Nov 16 '19 at 14:34