File > Settings > Build, Execution, Deployment > Java Compiler
Change Target bytecode version to 1.8 of the module that you are working for.
If you are using Maven
Add the compiler plugin to pom.xml under the top-level project node:
org.apache.maven.plugins
maven-compiler-plugin
1.8
1.8