IntelliJ IDEA Cannot Run or Compile the Project
Workaround available Windows, macOS, Linux Updated November 13, 2026Based on 3 user reportsHow we research
Quick answer
If Run is greyed out or the build fails with odd errors, usually the project is not recognised as Maven/Gradle or has no SDK or source roots.
Most likely fix: Open as a build project
How to fix it
Try these in order — the most common fix is first.
1. Open as a build project
- Use File | Open and select pom.xml or build.gradle, then choose Open as Project
Did this fix it?2. Check SDK and source roots
- See File | Project Structure and mark source roots as needed
Did this fix it?3. Rebuild
- Use Build | Rebuild Project
Did this fix it?4. Invalidate caches
- File | Invalidate Caches, then Invalidate and Restart
Did this fix it?
Symptoms
Run button disabled, 'No main class found', build errors that do not occur in the terminal.
Why it happens
- Project opened as plain folder instead of via pom.xml/build.gradle
- No SDK or output path
- Source root not marked
- Stale build output
This guide also covers
- intellij cannot run project
- intellij run button greyed out
- intellij no main class found
Still not working?
If JetBrains IntelliJ keeps failing, you're not alone. See every JetBrains IntelliJ problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to us