If Minecraft Java Edition keeps crashing every time you load a world or mid-game, you are dealing with one of the most frustrating bugs in the game. Whether it is a plain crash to desktop, a Java error, or the launcher just closing itself, the fixes below cover every scenario. All tested on Minecraft 1.21.x as of February 2026.
Quick Fix
This solves the crash for most players in under 2 minutes:
- Open the Minecraft Launcher and click Installations.
- Click the three dots next to your profile and select Edit.
- Click More Options and find the JVM Arguments field.
- Change
-Xmx2Gto-Xmx4G(allocates 4 GB of RAM instead of 2). - Save and launch the game.
If that did not work, keep reading for deeper fixes.
What Causes Minecraft Java to Crash?
Minecraft Java Edition crashes happen for three main reasons:
Not enough RAM allocated. The default 2 GB allocation is barely enough for vanilla Minecraft, and it is nowhere near enough if you are running shaders or mods. When Minecraft runs out of memory, it crashes instantly with no useful error message.
Outdated or corrupted Java runtime. Minecraft bundles its own Java runtime, but mods and older installations can force the game to use a system-installed Java version that is outdated or incompatible.
Mod and resource pack conflicts. Even one outdated mod can crash the entire game on startup. Fabric and Forge mods are not interchangeable, and mixing them is a guaranteed crash.
Fix 1: Allocate More RAM
This is the single most effective fix for Minecraft crashes.
- Open the Minecraft Launcher.
- Click Installations at the top.
- Hover over your profile and click the three dots, then Edit.
- Click More Options to reveal JVM arguments.
- Find
-Xmx2Gin the JVM Arguments field. - Change it to
-Xmx4Gfor vanilla, or-Xmx6Gto-Xmx8Gfor modded. - Click Save and launch.
Never allocate more than half your total system RAM. If you have 8 GB total, do not go above -Xmx4G. Over-allocating causes garbage collection stutters that are worse than the original crash.
Fix 2: Update GPU Drivers
Minecraft Java uses OpenGL for rendering, and outdated GPU drivers can cause crashes, especially with shaders.
NVIDIA: Open GeForce Experience or visit nvidia.com/drivers. Install the latest Game Ready driver.
AMD: Open AMD Radeon Software or visit amd.com/drivers. Update to the latest stable version.
Intel: Visit intel.com/download-center. Intel integrated graphics need driver updates more frequently for Minecraft compatibility.
After updating, restart your PC before launching Minecraft.
Fix 3: Remove or Update Mods
If Minecraft crashes on startup with mods installed, one of them is incompatible.
- Navigate to your Minecraft directory: Press Win + R, type
%appdata%\.minecraft, hit Enter. - Open the mods folder.
- Move ALL mods to a temporary folder on your desktop.
- Launch Minecraft. If it works, the crash is mod-related.
- Add mods back one at a time, launching after each, to find the culprit.
Common mod crash causes include Forge mods in a Fabric installation (or vice versa), mods built for 1.20.x running on 1.21.x, OptiFine conflicting with Sodium (pick one, not both), and two mods modifying the same game mechanic.
Fix 4: Update Java Runtime
Minecraft 1.21.x requires Java 21 or newer. If you are using an older installation or custom launcher, you might be running an outdated Java version.
- Check your Java version: Open Command Prompt, type
java -version. - Download the latest Java 21 from adoptium.net.
- Install the 64-bit version (critical for allocating more than 2 GB RAM).
- In the Minecraft Launcher, go to Installations then Edit then More Options.
- Point the Java executable to the new installation path.
If you are using the official Minecraft Launcher, it bundles Java automatically. But third-party launchers like MultiMC or Prism Launcher may need manual Java configuration.
Fix 5: Delete Corrupted World Data
If Minecraft crashes when loading a specific world but other worlds work fine, the world data is corrupted.
- Open
%appdata%\.minecraft\saves\. - Find the problematic world folder.
- Inside it, delete the
level.dat_oldfile if it exists. - If that does not help, try opening the world in an older Minecraft version first, then upgrading.
For important worlds, make a backup copy of the entire folder before attempting any fix.
Fix 6: Reset Minecraft Settings
Corrupted options files can cause crashes on startup.
- Navigate to
%appdata%\.minecraft\. - Delete these files (they will regenerate with defaults):
options.txt(video and control settings),optionsof.txt(OptiFine settings if installed), andservers.dat(server list, back this up first). - Launch Minecraft.
Your worlds, resource packs, and screenshots are in separate folders and will not be affected.
Fix 7: Use Optimized JVM Arguments
Replace your default JVM arguments with these optimized settings that reduce crash frequency:
-Xmx4G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=30 -XX:G1ReservePercent=20 -XX:G1HeapRegionSize=8M
These arguments tell Java to use the G1 garbage collector with settings optimized for Minecraft. The G1 collector handles memory more smoothly than the default, which reduces both crashes and microstutters.
To apply: Minecraft Launcher then Installations then Edit then More Options then paste into JVM Arguments field. Make sure -Xmx4G matches your desired RAM allocation.
Fix 8: Clean Reinstall Minecraft
If nothing else works, a clean reinstall often resolves deep corruption issues.
- Open the Minecraft Launcher and log out.
- Press Win + R, type
%appdata%, hit Enter. - Back up the
.minecraft\savesfolder (your worlds) and.minecraft\screenshots. - Delete the entire
.minecraftfolder. - Open the Minecraft Launcher and log in again.
- Let it re-download all game files.
- Restore your saved worlds from the backup.
This gives you a completely fresh installation while preserving your worlds.
How to Prevent Minecraft Crashes
Keep your mods updated when Minecraft updates. Most crash-on-startup issues after a game update are caused by outdated mods.
Always allocate enough RAM. Set -Xmx4G as your baseline and increase if you run shaders or large modpacks.
Do not mix mod loaders. Forge and Fabric are separate ecosystems. Pick one per installation profile.
Check crash reports. They are saved in %appdata%\.minecraft\crash-reports\ and usually tell you exactly which mod or system caused the crash.
FAQ
How much RAM should I allocate to Minecraft?
For vanilla: 4 GB (-Xmx4G). For mods: 6-8 GB. For large modpacks with shaders: 8-10 GB. Never allocate more than half your total system RAM.
Can OptiFine cause crashes?
Yes. OptiFine conflicts with Sodium, Iris, and several Fabric mods. If you are using Fabric, use Sodium plus Iris instead of OptiFine. On Forge, OptiFine is generally safe but check the version matches your Minecraft version exactly.
Minecraft crashes with Exit Code 1. What does it mean?
Exit Code 1 is a generic Java error. Check the crash report in .minecraft\crash-reports\ for the actual cause. Common culprits are mod conflicts, outdated Java, or insufficient RAM allocation.
Will deleting .minecraft remove my worlds?
Yes, which is why you must back up the saves folder first. Copy it to your desktop, delete .minecraft, reinstall, then copy the saves folder back.
Minecraft crashes only when using shaders. Why?
Shaders require significantly more VRAM and RAM. Allocate at least 6 GB RAM, update your GPU drivers, and try a lighter shader pack. Complementary Shaders are more stable than BSL or Continuum on lower-end hardware.