Explain Codes LogoExplain Codes Logo

Intellij IDEA 13 uses Java 1.5 despite setting to 1.7

java
intellij-idea
maven
gradle
Alex KataevbyAlex Kataev·Feb 24, 2025
TLDR

Ensure IntelliJ IDEA is utilizing Java 1.7 by configuring both the Project SDK and Language level of your module to reflect this version. Do this via File > Project Structure, setting Project SDK: 1.7 and Language level: 7.0. Moreover, ensure the Java Compiler settings are attuned to 1.7 in File > Settings > Compiler > Java Compiler and making certain the Project bytecode version and Per-module bytecode version are both set to 1.7.

Project SDK -> 1.7
Language level -> 7.0
Java Compiler -> Project bytecode version -> 1.7

Apply these unified settings to rectify the Java version issue.

Syncing Maven or Gradle

When working with Maven or Gradle, it's vital to synchronize the compiler plugin settings with your IntelliJ configuration. For Maven, designate source and target to 1.7 in your pom.xml:

<plugin> <!-- This Maven doesn't fly without 1.7 --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin>

For Gradle, ensure your build.gradle reflects the correct sourceCompatibility and targetCompatibility:

// 1.7: The chosen One! sourceCompatibility = '1.7' targetCompatibility = '1.7'

Update IntelliJ IDEA

Fight compatibility issues by staying current with the latest version of IntelliJ IDEA. Even though IDEA 13 is your current environment, it's worth considering upgrading to avail the newest language and tooling support.

Version control sanity check

Unintended reversions can occur as silly side-effects of using version control systems like Git. Stay alert for any commits that might have inadvertently tweaked the project/compiler settings.

Ensuring module consistency

Confirm the bytecode version of each module matches the project's settings. IntelliJ IDEA allows per-module configurations, which could provoke inconsistencies.

Visual guides aid

Intricate settings can be challenging to navigate. Keeping in line with up-to-date visual guides can be helpful. Check the IntelliJ IDEA documentation and relevant online resources for screenshots reflecting the current UI.

Don't hesitate to reach

Despite following the above steps, if the issue persists, consider reaching out to the community on forums, discussing the issue with colleagues, or consulting the proficient minds on StackOverflow.