a jni error has occurred please check your installation and try again minecraft что делать
A JNI error has occurred, please check your installation and try again при компиляции java программы
Многие новички, которые изучают программирование на Java при компиляции могут столкнуться с ошибкой «A JNI error has occurred, please check your installation and try again». Ошибка выскакивает даже если запускать совсем простой код типа «hello world!» как в примере ниже.
Пример простого кода Hello World!
Обычно компиляция проходит, но созданный класс не интерпретируется. У большинства пользователей ошибка появляется из-за следующих двух моментов:
Как исправить ошибки при запуске и компиляции?
Первое, что следует проверить – пути в переменных средах. По списку первым например стоит путь:
«C:\Program Files (x86)\Common Files\Oracle\Java\javapath»
А в конце каталог до jdk:
Операционная система компьютера находит екзешник «java.exe» и первым делом смотрит в «..\javapath» и останавливает поиск. Вам нужен файл что лежит в «…jdk\bin». В переменных средах сначала нужно поставить \jdk\bin, а потом уже \javapath. В конечном результате путь должен быть примерно такой:
PATH=C:\Program Files\jdk\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\QuickTime\QTSystem\
Во втором случае всё еще проще. Если вы компилируете используя более позднюю версию Java Runtime 54, то соответственно и запуск нужно производить в аналогичной версии. Сама строчка «hello has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 53.0» как раз говорит нам об этом. Проверить это можно вбив фразу в тот же Гугл Переводчик.
Compiled by a more recent version of the Java Runtime
Выводы
Как видим с ошибкой» A JNI error has occurred, please check your installation and try again» при компиляции Java программы в основном сталкиваются новички. Решить проблему можно проверив версии Java при компиляции и запуске файлов программы. А так же просмотреть корректность путей к «\jdk\bin» и «\javapath». Напишите в комментариях помогло ли вам решение и удалось ли запустить вашу первую программу.
При запуске какого-либо кода, написанного на Java, программист может получить сообщение об ошибке с текстом «A JNI error has occurred, please check your installation and try again». Обычно причиной ошибки выступает разница в версии компилятора и среды выполнения, из-за чего происходит некорректная интерпретация и выполнение имеющегося кода. Ниже разберём, в чём суть данной ошибки, как её исправить, а также отдельно укажем, как решить данную ошибку при запуске игры Minecraft.
Что такое JVM, JNI и JRE?
Как известно, программы, написанные на «Java», компилируются в байтовый код, который распознаётся виртуальной машиной Ява, называемой «JVM» (Java Virtual Machine). JVM по своей сути является компьютерным симулятором, и при запуске программы написанной на Java, распознаёт инструкции байтового кода, и переводит их в машинные инструкции собственной системы.
JVM должна обеспечивать удобный способ доступа к ресурсам системы – файлам, сетевым соединениям, видеокарте и другим компонентам. Механизмы доступа к этим ресурсам напрямую зависят от системы, в которой работает JVM. Для обеспечения своей работы виртуальная машина использует собственный интерфейс Java, называемый «JNI» (Java Native Interface).
Методы Java, использующие JNI для доступа к службам, квалифицируются термином «native». Квалификатор «native» сообщает виртуальной машине, что код для выполнения при вызове данного метода присутствует во внешней библиотеке. JVM ищет конкретный вызов библиотеки, который необходимо выполнить, на основе полного имени пути к методу и его аргументам. Существует специальное соглашение об именах, позволяющее сопоставить метод с конкретной ссылкой на внешнюю библиотеку.
Как мы уже писали выше, Java имеет собственные библиотеки для обеспечения базового взаимодействия с системой на уровне чтения-записи файлов, создания сетевых подключений и вывода изображения на экран. Они распространяются с JVM как часть среды выполнения Ява, известные как «JRE» (Java Runtime Environment), независимо от того, является ли она автономной JRE или включена в Java Development Kit (JDK).
Причина проблемы A JNI error has occurred, please check your installation and try again
Текст данной ошибки переводится как «Произошла ошибки INI, пожалуйста, проверьте вашу инсталляцию и попробуйте вновь». Данная ошибка, получаемая при запуске программы на JVM, указывает на проблему с запуском кода, связанного с собственным методом.
Причины проблемы могут быть следующими:
Давайте разберём способы, позволяющие устранить ошибку JNI на вашем ПК.
Установите одинаковую версию JRE и JDK
Исправить ошибку «A JNI error has occurred» поможет обновление JRE и JDK до актуальных синхронных версий. Необходимо убедится в их одинаковой версии, для чего вызовите системную строку (нажмите Win+R, введите там cmd и нажмите ввод), и наберите там:
Затем наберите: javac –version
Если версии синхронны, тогда ваш код Java необходимо будет скомпилировать с помощью компилятора новой версии. После этого ошибка «A JNI error has occurred, please check your installation» может быть устранена.
Правильно настройте переменные среды для Java
Для исправления ошибки «A JNI error has occurred» может понадобится настроить переменные среды для Java. Выполните следующее:
[Updated] Minecraft ‘A JNI error has occurred, please check your installation and try again’ or ‘Java exception’ after 1.17 update? Here’s how to fix
New updates are being added at the bottom of this story…….
Original story (published on June 09, 2021) follows:
Minecraft players are finally getting their hands on the latest 1.17 Caves and Cliffs: Part 1 update that brings three new mobs — goats, glow squids, and axolotls amongst many other additions.
Of course, it’s a massive update that players have been looking forward to for weeks, and now that it’s here, players around the world are checking out the new update to see what it has to offer.
Unfortunately, it seems that the new update is off to a bumpy start. Some individuals who’ve installed Minecraft 1.17 are reporting that they’re getting an error message that says ‘A JNI error has occurred, please check your installation and try again’ or ‘Java exception’.
We’ve shared some reports from disgruntled users below for reference:
When i try to play 1.17-rc1 or snapshots it gives 2 errors. Error1: A JNI error has occored please check your installation and try again. Error2: A java exeption has occored (Source)
Does the server file work yet? I keep getting the error code: A JNI error has occurred, please check your installation and try again. (Source)
I have 1.17 Minecraft server files install but they’re giving me a JNI error, maybe its the launcher? (Source)
According to players, they aren’t able to install and play Minecraft 1.17 because they keep getting a ‘JNI error’ or ‘Java exception’ error.
Players have even confirmed that their computers do have Java installed but the error still pops up.
Naturally, this has left many players scrambling to find a fix. In case you’re one of them, well, there’s no reason to fret.
The ‘JNI error’ that has started popping up with the latest Minecraft 1.17 update can be fixed by installing Java 16, as confirmed by many reports from players who were experiencing the problem.
Minecraft 1.17 requires Java 16 or later to work, hence the game does not work on computers that do not meet the requirements.
That said, in case you need a video guide to help fix the issue, we’ve shared one below.
Once you install Java 16 on your computer, you should be able to play the Minecraft 1.17 update without worrying about running into the ‘JNI error’.
Feel free to drop a comment letting us know whether or not this fixed the problem for you.
Update 1 (June 10)
Going by the bug page for “A JNI error has occurred, please check your installation and try again” at Mojang support, here’s something you need to know:
Minecraft now uses a more recent version of Java. If you are using a default setup the Launcher will download and install the correct version. If you are using a custom Java setup or a third-party launcher, you will need to ensure that your Java installation is version 16 or above.
And here’s how you can resolve the problem:
To fix this issue, download the AdoptOpenJDK and follow the steps below for the client or server.
Client: Make sure that your launcher is running Java 16. To do so, change the Java executable runtime to target “javaw.exe” in C:\Program Files\Java\jdk-16.0.1\bin\javaw.exe or where you installed Java 16. Contact your launcher maintainers if you cannot switch or do not know how to switch to Java 16.
Try uninstalling Java 8 and restart your computer to make sure you are running Java 16. If you are running a server with a host, contact the host.
If none if this works, please contact Community Support.
Update 2 (June 11)
Going by users reports, those of you facing the issue on Linux, here’s a tip for you:
MAKE SURE TO UPDATE
sudo apt-get update
sudo apt search jdk
“find openjdk version 17” OR just do this command
sudo apt install openjdk-17-jdk
enjoy the new 1.17 update yall 😀
In case, openjdk-17-jdk does not appear on entering “sudo apt search jdk” and on entering sudo apt install openjdk-17-jdk it says “Unable to locate package openjdk-17-jdk” you will be required to add another repository first. Here’s how a user puts it:
sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
Optional: sudo apt search jdk
I found openjdk-16-jdk so I installed that; I didn’t see openjdk-17-jdk, but 16 works
sudo apt install openjdk-16-jdk
Update 3 (June 18)
An individual has highlighted some important information surrounding the availability of Java 16 on Mojang’s support website. Check out the information below:
Unlike Java 8, there’s no single provider of downloads for Java 16. Some major ones are:
– OpenJDK (from Oracle): https://jdk.java.net/16/
– Oracle: https://www.oracle.com/java/technologies/javase-jdk16-downloads.html
Oracle was historically the primary provider of Java, but their free downloads are now only intended for developers. Their standard releases are now paid and cost several hundred dollars per year. OpenJDK downloads are not included in this.
– Amazon Corretto (from Amazon): https://docs.aws.amazon.com/corretto/latest/corretto-16-ug/downloads-list.html
– Zulu (from Azul): https://www.azul.com/downloads/#download-openjdk
– AdoptOpenJDK (from Eclipse Foundation, sponsored by many organizations including Amazon, IBM, and Microsoft): https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=hotspot
I would personally recommend AdoptOpenJDK, but the choice here is up to you.
Update 4 (July 16)
For those of you facing error or crash while loading the resource packs in the Java Edition, the official troubleshooting page suggests you to uninstall and re-install them. Following are the details:
If resource packs or mods fail to load or cause your game to crash, you will need to uninstall and reinstall them one at a time to find which one is the cause.
Tip: If you know the order in which you installed them, you can uninstall them in reverse order, testing after each uninstall.
Since resource packs and mods are not created by Mojang Studios, we do not offer support for them. If you need further assistance, contact the author of the mod or resource pack.
PiunikaWeb started as purely an investigative tech journalism website with main focus on ‘breaking’ or ‘exclusive’ news. In no time, our stories got picked up by the likes of Forbes, Foxnews, Gizmodo, TechCrunch, Engadget, The Verge, Macrumors, and many others. Want to know more about us? Head here.
For windows Error: A JNI error has occurred, please check your installation and try again #292
Comments
drs357 commented Jun 19, 2019
Error: A JNI error has occurred, please check your installation and try again
This is on a windows 10 machine, can someone please help me?
The text was updated successfully, but these errors were encountered:
kpepper commented Jun 19, 2019
What version of the Artemis software do you have installed?
If it’s the latest (18.0.2) then you will need Java version 9 or above (ideally version 11.0.2) installed. Java can be downloaded from here: http://jdk.java.net/archive/
If you bring up a DOS window and type:
what version does it show?
You could also try right-clicking on the artemis jar and selecting Open with. Java.
drs357 commented Jun 19, 2019
Thank you, I needed to update the jdk.
BMDeepak commented Jun 20, 2021
Same issue I am working with jdk 1.8.0_291
mattbird567 commented Aug 13, 2021
java version «1.8.0_301» Java(TM) SE Runtime Environment (build 1.8.0_301-b09) Java HotSpot(TM) Client VM (build 25.301-b09, mixed mode)
When i try and open the Artemis.jar file howveer i am still getting theses two errors:
Error: A JNI error has occured, please check your installation and try again
A Java Exception has occurred
JNI error has occurred. Please check your installation
I’m trying to run a very simple test using TestNG, but I’m getting this error message. I tried reading the previous answers, but it is not working to me. I would be happy if someone could help me out, since I’m just a beginner in TestNG. This is the error message :
13 Answers 13
Yes there is an issue with testNG running on eclipse. As of this post you can try a workaround to fix your error by adding the jcommander jar file in your build path and then run your testNG suite from eclipse.
Similarly replace your path for windows too and your test suite will run as without any errors using command prompt.
This typically happens when your JDK version and JRE version are not compatible or when the required JRE version is not installed.
To overcome from this problem, we need to download the jcommander1.7 jar file. to download the jar file visit below url and get jcommander1.7 jar file
Process to implement jcommander1.7 jar file-
Right click on the project->Properties->click on the liabraries->click on the Add external jars->navigate to the location where jcommander1.7 jar file is downloaded.
and run your script, now your script will run successfully.
Add jcommdar.jar to classpath and then run:
It is really helped for me.
I had the similar error while running my testng.xml. I replaced my selenium server jar which was included(build path) by a local user from his local path. Copy the jar files to the project folder(lib) and include them in your project. This worked for me.
I also got the similar kind of error when was trying to run DemoTest.xml file as TestNG Suite using Eclipse IDE.
For me the issue got resolved when added testng-6.11.jar in the build path of the project. Follow the below mentioned steps:
Try to change the configured version of Java using the following command:
This command will show:
Choose the appropriate version and done.
I got this issue, after uninstalling my java jdk newer version and upgrading to java jdk older version.
I have resolved it, by recreating my java project in eclipse.
bellow solutions fixed my issue. thanks
To overcome from this problem, we need to download the jcommander1.7 jar file. to download the jar file visit below url and get jcommander1.7 jar file
Process to implement jcommander1.7 jar file-
Right click on the project->Properties->click on the liabraries->click on the Add external jars->navigate to the location where jcommander1.7 jar file is downloaded.
and run your script, now your script will run successfully.









