-4

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?

Image

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

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
  • 1
    If 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