IntelliJ IDEA Cannot Run or Compile the Project

Share
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. 1. Open as a build project

    1. Use File | Open and select pom.xml or build.gradle, then choose Open as Project
    Did this fix it?
  2. 2. Check SDK and source roots

    1. See File | Project Structure and mark source roots as needed
    Did this fix it?
  3. 3. Rebuild

    1. Use Build | Rebuild Project
    Did this fix it?
  4. 4. Invalidate caches

    1. 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
Fixed it? Share this guide

Other JetBrains IntelliJ errors

All 12 JetBrains IntelliJ errors and fixes →