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

[Eclipse] - A JNI error has occurred, please check your installation and try again(JVM)

Show

Error: A JNI error has occurred, please check your installation and try again Linux
주현2020. 2. 26. 13:34

이클립스를 지우고 Java프로젝트를 실행하니 다음과 같은 오류가 발생했다 !

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

Java Virtual Machine Launcher

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

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

구글링 해보니 자바의 버젼이 맞지 않아서 발생하는 오류였다.

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

이클립스 - Project - Properties 클릭

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

Compiler compliance level: 에서 자바를 설치한 버전에 맞게 변경해준다.

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

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

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

TAG