0

I am new in java programming and now i am testing a helloworld code to test. I use the command javac HelloWorld.java in the console folder it's create a file HelloWorld.class . When i am running the command java HelloWorld i get

Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWorld has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 52.0 ...

I have to mention that i have JDK 14.0.2 installed and JRE ( for minecraft and server :) )

  • 3
    Does this answer your question? [Error: A JNI error has occurred, please check your installation and try again - during running Java program from Ubuntu terminal](https://stackoverflow.com/questions/52671412/error-a-jni-error-has-occurred-please-check-your-installation-and-try-again) – Svirin Aug 28 '20 at 23:18
  • yes , thanks @Svirin . the command was "javac -target 8 -source 8 `file`" . – picantultunic Aug 28 '20 at 23:25
  • The command should be `java HelloWorld` without the `.java`, but more important, when you type in the `java` command are you sure it's executing the one you think it is? – Stephen P Aug 28 '20 at 23:27

1 Answers1

1

Don't run java HelloWorld.Java instead Run java HelloWorld ie without .java extensions.

Saurabh Nigam
  • 795
  • 6
  • 12