IntelliJ IDEA: Run single class ignoring compile error in other class

To be able to run code with errors you need to make a change in the settings. Go to Build, Execution, Deployment | Compiler | Java Compiler and set the Use compiler: combobox to Eclipse and enable the proceed on errors checkbox. This allows to compile classes even when they have errors.

To start a Run Configuration when the project has errors, you will need Build, no error check in the Before Launch section, instead of Build.


You can put your CompileErrorClass in a folder, then go to "Project Settings/Module" and mark the folder as "Excluded". The folder will be shown on red.

Shorcut: you can "right click" the folder an select "Mark Directory as Excluded".

In the image you can see the "bean" directory in red.Bean directory marked as "Excluded".