Error: A JNI error has occurred, please check your installation and try again
已回答
Just downloaded IntelliJ IDEA and Java from Oracle and trying to compile/run code that was written 2 years ago. I get the following error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: main/java/MainTraining has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 52.0
java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) Client VM (build 25.271-b09, mixed mode, sharing)
请先登录再写评论。
According to the error, you need JDK 15 to run `main/java/MainTraining` instead of JDK 1.8.
See https://stackoverflow.com/questions/47457105/class-has-been-compiled-by-a-more-recent-version-of-the-java-environment
It is not related to IDE.
Thank you. I removed Oracle Java and replaced with IntelliJ IDEA Community Edition IC-202.7660.26 java version "15.0.1" SDK. I don't get errors now. Does that make sense to you?
> Does that make sense to you?
I am not sure I got you right. Do you need any further assistance?
Konstantinos Konstantin Annikov i must use jdk1.8 only . It does not point all maven libs and gives few class files of a jar not available
it gives Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"
any suggestion
Achuth W3
Does the project work well when using Maven build?
Please provide a minimal sample project so I can reproduce the issue without including your sensitive code. Thank you! Please upload it to https://uploads.jetbrains.com/ and paste the upload id here.
Usually, upgrading the JDK used in the project to JDK 11 or above solved the problem as IDEA delegates the build process to JDK.