Some players are getting an error that prevents the game from launching. In this guide we will see how to fix Minecraft A JNI Error Has Occurred or A Java Exception Has Occurred pop-up error.
Fix Minecraft ‘A JNI Error Has Occurred’
While trying to launch Minecraft on PC, some players get an unexpected pop-up that prevents them from launching and playing the game. Here are some ways to fix the Minecraft A JNI Error Has Occurred or A Java Exception Has Occurred error.
First, you will need to check if you are running the latest version of Java. Minecraft version 1.17 will only run on Java 16 and above, so if you have not tried downloading the latest Java, then this is the time to check for it.
Read More: How to Fix Minecraft Error Code 500 & 502
Select the Windows x64 installer to download it. Once that is done, open the Java folder and create a new folder called Server. Put a file called server.jar in it, then create a text file with the file name eula.txt. In it, type eula=true. Create another text file for the same folder and put in the following command:
“C:\Program Files\Java\jdk-16.0.2\bin\javaw.exe” -Xmx1024M -Xms1024M -jar server.jar
pause
Save this text file as start.bat. Use this to start up your server.
You can also manually change launcher settings to let Minecraft pick up on the latest Java by going to Installations > Latest Release or Profile of Choice > More Options > Delete every other Java Executable. You can also do the same by using Run > system.cpl > Advanced > Environment Variable > System Variable > Edit Path. you can find the corrupted Java file here, which you can delete. Restart your PC and launch the game to see if it helps.
Linux users can update their Java by updating sudo apt-jdk. search for sudo apt-jdk in the Linux command search, then find openjdk version 17 or input the command sudo apt install openjdk-17-jdk. You can also try to add -Xmx8192M -Xms128M for an 8GB server as an additional command line to make it work. For any other server size, you can refer to the following:
- java-Xmx2048M -Xms128M-jar server.jar nogui (2GB server)
- java-Xmx4096M -Xms128M-jar server.jar nogui (4GB server)
- java-Xmx6144M -Xms128M-jar server.jar nogui (6GB server)
- java-Xmx8192M -Xms128M-jar server.jar nogui (8GB server)
- java-Xmx16384M -Xms128M-jar server.jar nogui (16GB server)
Also, changing the default under openjdk-17-jdk and finding Sudo update-alternatives –config java and sudo update-alternatives –config javac, change the default value to 0.
In case this didn’t work, you can use the following Linux commands
- sudo add-apt-repository ppa:linuxuprising/java
- sudo apt-get update
- Optional: sudo apt search jdk
- Openjdk-16-jdk / openjdk-17-jdk
- sudo apt install openjdk-16-jdk / openjdk-17-jdk
For Windows users, instead of installing the entire Java JDK, you can copy the JRE installation that comes along with the Minecraft client. For Minecraft 1.17, you can find it in C:\Program Files (x86)\Minecraft\runtime\java-runtime-alpha. Find and run the Java.exe file in the folder.
For Titan Launcher for Windows:
- Download and install jdk-16.0.2_windows-x64_bin.exe. This is for Windows x64, you can select which is appropriate.
- Take a note of the installation path, eg, C:\Program Files\Java\jdk-16.0.2
- Go to Titan Launcher > Edit > Java Settings (Advanced) > Executable
- Enter your installation path with the .exe file.
- Go to “JVM Arguments:” and remove the text line -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode
- Your default should now look like -Xmx1G -XX:-UseAdaptiveSizePolicy -Xmn128M. Save the profile and launch the game.
Finally, you can update your GPU drivers and check if your antivirus or firewall has blacklisted Minecraft from working optimally. If none of the above solutions work, then you can report it to the Minecraft support page to get the problem rectified.
That’s all there is to know about Fix Minecraft ‘A JNI Error Has Occurred’. If you like this guide you can check out our other guides as well.