Intellij: Error:java: error: release version 5 not supported
To fix the IntelliJ compilation error, update the Project bytecode version. Open Project Structure (Ctrl+Alt+Shift+S
), choose a compatible JDK in Project Settings > Project SDK, and tweak the Project language level:
Ctrl+Alt+Shift+S > Project > Project SDK: 11 (or newer)
Project language level: 11 (same as SDK)
Save the changes and rebuild the project.
Maven setup: Exemplary pom.xml
for Java 11
Ensure Maven supports Java 11 by modifying your pom.xml
:
This config guarantees source
and target
bytecode compatibility with Java 11. Cross-verify with IDE settings for Maven project compilation:
Settings > Build, Execution, Deployment > Compiler > Java Compiler
Here, set "Per-module bytecode version" to 11.
JDK Upgrade: Keep your sword sharp
If you're lagging with outdated JDK, you might need to spend some time downloading a fresh JDK. Make sure it's the same version you specified in pom.xml
. Use trusted sources like Adoptium for downloads:
- Head to Adoptium & choose JDK version.
- Follow instructions to install.
- Setup the newly minted JDK in IntelliJ (Project Structure).
Ctrl+Alt+Shift+S > Platform Settings > SDKs > Add New JDK
IntelliJ Compiler Settings: The Magic Wand
Check the Java version of the IntelliJ compiler to ensure it's aligned with your system preferences:
Settings (Preferences on macOS) > Build, Execution, Deployment > Compiler > Java Compiler
Here, set the "Project bytecode version" to 11 and save changes.
Encoding & Consistency: Avoid Alien Characters
Ensure your pom.xml
has project.build.sourceEncoding set to UTF-8 for consistent encoding, avoiding any alien invasion (unwanted special characters):
Correct Syntax: groupId & artifactId
Ensure groupId and artifactId for maven-compiler-plugin is correct:
This avoids plugin resolution going wild, ensuring authentic plug-in usage.
Maven vs IntelliJ: Bytecode Version Face-off
Check that Maven project's bytecode version doesn't squabble with Java JDK version. IntelliJ IDEA lets you customize compiler settings per project - use it for harmonious Maven collaboration:
Maven Projects > Your project name > Lifecycle > compile
Examine the output - ensure consistency.
Outdated Java Versions: Leave them in the Past
Beware of ancient versions while setting project. Java 5 has retired; modern projects aim for Java 6 or higher, with preferential treatment for 1.8 (Java 8) or Java 11 due to wide acceptance and compatibility.
Unique Project Requirements: Tailor your Settings
Every project is unique. When necessary, you can specially tailor maven-compiler-plugin
settings to meet your project's idiosyncratic needs, ensuring project requirements aren't breached.
Was this article helpful?