I would recommend setting this within your pom.xml or build.gradle.
Maven compiler plugin (see the configuration block):
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<source>11</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Gradle (anywhere top-level within the script):
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_7
}
If for some reason you are not using these to build, I would seriously consider switching. See CrazyCoder's comment for an IntelliJ solution.