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

在使用cmd运行.class文件时发生错误:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.UnsupportedClassVersionError: Test01 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

错误:发生JNI错误,请检查安装并重试(JNI是Java Native Interface的缩写)
这是由于Java的版本和JDK版本不同。
解决办法:
Window->Preferences->Java->Compiler进入如下界面,然后接着选择JDK版本
在这里插入图片描述
最近笔者也在运营公众号,欢迎大家的关注!我们一起学习Java,一起进步。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_45965358/article/details/113833790
今日推荐