By default, Intellij IDEA doesn’t compile classes automatically. But, you can enable the auto compile feature by following steps :
- In “Project settings or preferences”
- Select “Build, Execution, Deployment -> Compiler”
- Checked
Make project automatically

P.S This feature is available since IDEA 12