Skip to content

How to fix ‘Java: compilation failed: internal java compiler error’?

  • by
  • 3 min read

Programming has become far easier as compared to what it used to be back in the day. That said, it’s still fairly difficult and random bugs and glitches are the order of the day. 

In this article, we’re talking about the “Java: compilation failed: internal java compiler error” problem when compiling code in Java, its causes and what you can do to fix the issue. 

What causes this error?

There are a number of different reasons why your Java compilation might fail, some of the most common ones being.

  • Outdated Java compiler
  • Wrong or corrupt JDK installation.
  • Incorrect installation path.

Also read: How to fix ‘Runtimeerror: cudnn error: cudnn_status_not_initialized’?

How to fix this?

Here are six solutions you can try out. 

Restart the IDE

One of the first things you should do is try and restart the IDE. More often than not, IDE caches fill up with random files and failed builds over the course of development and restarting can help clear it out, especially if you’re getting build or compilation errors without any reason in particular. 

Top 10 programming languages to learn in 2019

Rebuild the project

Sometimes, the best way around compilation errors is to just try again. Trying a fresh build with the cache files removed and the previous builds cleared can give you a successful compilation. 

Try using the terminal

To isolate the issue from your IDE, you can try compiling your code in the terminal (Command Prompt if you’re on Windows) to see if the issue lies in your code, the JDK or your IDE. 

To do so, just navigate to the directory where your code is in and run the following command. 


If the compilation is successful, you most likely have an issue with your IDE rather than JDK or your code. 

Update JDK

Updating your JDK version can also help get rid of uncalled-for compilation issues. Head over to Oracle’s JDK download page and download the x64 installer for the latest JDK version ( at the time of writing). Install the downloaded installer once the download is complete. 

A JNI error has occurred in Minecraft: 3 Fixes
You can check out our detailed guide on how to install Java on Windows here and Linux here

Update your IDE

Another potential fix for the situation can be updating your IDE. As JDK versions and compilers update, your IDE also needs to update to keep up with the latest changes. Using an outdated IDE with a newer version of a programming language it doesn’t exactly support is a recipe for disaster. Not only will you have a horrible code writing experience, but you’ll also run into compatibility issues and build errors like this one. 

Give the compiler more storage

Also called the build process heap size, increasing this gives the compiler more headroom when building a program and avoids memory errors. Whether you’re using IntelliJ, BlueJ, NetBeans or Eclipse, most IDEs do have this setting (albeit named differently). 

Also read: How to fix ‘Internal exception connection reset realms’?

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: