I am using IntelliJ IDEA 2017.3. I have a project called "test", which has two classes under the src folder:
Main, has main method to print out "Hello World"CompileErrorClass, has one method with compile errors
Those two class have no dependencies. I was trying to run the main() in the Main class, and set the before launch to "build, no error check"

I got an error message
"Error: Could not find or load main class Main".
When I fixed the compile error in CompileErrorClass, the main() worked as expected. Or if I ran the same project in Eclipse, it worked fine even with compile error.
How can I setup the run configurations in IntelliJ to run a single class ignoring the compile errors in other class without dependencies?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With