Hi, This is a common problem when you want to run a java program using the command line. The problem is occurring for so many reasons. Most of the cause is the different versions of the Java JDK and the Java JRE versions. I have been having this problem for a while, but now I have figured it out. It turns out that Java JDK 15 have both the JRE and the JDK inside the bin
folder of the Java 15 JDK. (I have always believed that JRE and JDK are different application, but it turns out things have changed) My problem was that I had Java JDK 15 installed on my computer At the same time, I had Java 8 (JRE) installed on my computer. So my computer is getting confused. Open the command prompt to check the version of the
java and java compiler: Typed the following commands: java -version// this gave me Java 8 After that, type javac -version// this gave me Java 15 a JNI error has occurred please check your installation and try again Exception in thread mainIn other words, my program is getting compiled with Java 15 and I am trying to run with Java 8. This is the problem of ” a JNI error has occurred please check your installation and try again Exception in thread main ……” To solve the problem, I uninstalled Java 8 JRE from my computer. Went back to the command prompt to check if “java -version” and “javac -version” are returning the same version number or not, In my case it’s yes, it is returning Java 15. Tried recompiling my program, and running it. It Worked!! a JNI error has occurred please check your installation and try again Exception in thread mainWow! It works fine. If not then comment…… Read more articles터미널에서 클래스파일 실행하니까 에러 Error: A JNI error has occurred, please check your installation and try again java.lang.UnsupportedClassVersionError: com/eomcs/lang/ex01/Exam0300 has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 이클립스 컴파일러 JDK 버전이 더
높아서 에러 발생 이클립스 컴파일러 버전 이클립스와 동일한 버전의 JDK를 설치해준다 JDK설치 설치가 다 되면 이 버전을 기본으로 설정할 거냐고 물어본다. 이제 잘 된다ㅎㅎ |