Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: XXXXX has been compiled by a more recent version of the Java Runtime (class file version 57.0), this versio..

CODEDRAGON Development/Java

반응형

 

 

 

오류메시지

Error: A JNI error has occurred, please check your installation and try again

Exception in thread "main" java.lang.UnsupportedClassVersionError: XXXXX has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0

 

C:\CodeLab>java ArrayEx24 apple
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: ArrayEx24 has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
 
C:\CodeLab>

 

 

 

오류 원인

컴파일한 자바버전과 실행시 사용하고 있는 자바버전이 다른 경우 발생합니다.

 

C:\CodeLab>java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
 
C:\CodeLab>

 

C:\Program Files\Zulu\zulu-13\bin>java -version
openjdk version "13.0.1" 2019-10-15
OpenJDK Runtime Environment Zulu13.28+11-CA (build 13.0.1+10-MTS)
OpenJDK 64-Bit Server VM Zulu13.28+11-CA (build 13.0.1+10-MTS, mixed mode, sharing)
 
C:\Program Files\Zulu\zulu-13\bin>

 

 

 

해결방법

환경설정을 통해 동일 Java 사용하도록 설정합니다.

https://codedragon.tistory.com/4590

 

개발환경 구축 - eclipse를 통한 Java 프로그래밍

eclipse를 통한 Java 프로그래밍 JDK 설치 시스템 환경변수 등록하기, Java 컴파일 환경 구성, Path설정 eclipse 설치 JDK 설치 http://codedragon.tistory.com/2348 JDK 설치 - 단계별 Step by Step java 개발 환..

codedragon.tistory.com