IntelliJ Errorjava error release version 5 not supported
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
When working with IntelliJ IDEA, a popular Integrated Development Environment (IDE) for Java and other programming languages, developers may sometimes encounter the error: Error:java: error: release version 5 not supported. This error stems from compatibility issues between the Java version used in the project and the Java version supported by the compilation tools within IntelliJ.
Understanding the Error
Java, being both forward and backward compatible, generally allows developers to run programs on newer versions of the Java Runtime Environment (JRE) than they were originally compiled for. However, the source code must be compiled with a compatible version of the Java Development Kit (JDK) for the target JRE version.
The error “release version 5 not supported” specifically indicates that an attempt is being made to compile Java source code with a target version (in this case, Java 5), which is not supported by the compiler in use. As newer versions of JDK drop support for older versions of Java, if the JDK configured in IntelliJ IDEA is newer (for example, JDK 9 or higher), it will not support compiling for Java 5.
Reasons Behind the Error
- Project SDK Configuration: The project's Software Development Kit (SDK) in IntelliJ might be set to a version that does not support compiling to Java 5.
- Compiler Settings: IntelliJ allows specific configuration of compiler options, including the
--releaseflag which is used to specify the target platform for which the code is being compiled. Setting this to a version not supported by the installed JDK will lead to errors.
Resolving the Error
To resolve this error, consider the following approaches:
- Update Project SDK: Go to
File > Project Structure > Projectand select a JDK version that supports compiling to the desired target Java version. - Adjust Compiler Options: Navigate to
File > Settings > Build, Execution, Deployment > Compiler > Java Compilerand modify theTarget bytecode versionto a version compatible with the JDK in use. Alternatively, remove specific configurations that may force the compilation to an unsupported Java version. - Upgrade Java Version: If maintaining older versions of Java is not essential, consider upgrading the minimum Java version requirement of your project to align with the supported versions of the installed JDK.
- Install and Configure Multiple JDKs: IntelliJ supports configuring multiple JDKs. Set up a JDK that supports Java 5 specifically for projects that must compile under this version.
Practical Example
Suppose your IntelliJ project is inadvertently configured with JDK 15 and set to compile to Java 5. You will see this error because JDK 15 does not support Java 5 targets. To fix this:
- Install JDK 8 (as it supports lower versions including 5).
- Configure your project to use JDK 8 through
File > Project Structure > Project > Project SDK.
Additional Points to Consider
- Compatibility Issues and Maintenance: Continuously using older Java versions can lead to compatibility issues with libraries and frameworks, as well as potential security risks. Consider the migration to newer versions as a long-term solution.
- Environment Consistency: Ensure that the Java version used for development is the same as in other environments like testing and production to avoid discrepancies and unforeseen errors.
Summary Table
| Issue Description | Solution | Consideration |
| Target version unsupported by current JDK | Update JDK or adjust target version | Project compatibility |
| Compiler settings misconfiguration | Correct Target bytecode version | Build correctness |
| Need to maintain old Java version compliance | Install multiple JDKs with different versions | Development flexibility |
IntelliJ IDEA offers robust project configuration options to manage different versions of Java. However, understanding the interaction between JDK versions and Java release versions is crucial to maintaining a healthy development environment and avoiding compatibility errors such as “release version 5 not supported.”
Related reading
- intellij idea - Error java invalid source release 1.9
- Intellij IDEA complains cannot resolve spring boot properties but they work fine
- Intellij IDEA, format all code in a project
- IntelliJ IDEA generating serialVersionUID
- Intellij IDEA Java classes not auto compiling on save
- intellij incorrectly saying no beans of type found for autowired repository
- Intellij Idea Importing Gradle project - getting JAVA_HOME not defined yet
- IntelliJ IDEA jump from interface to implementing class in Java

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.