Error java source option 5 is no longer supported use 6 or later intellij idea

How to fix the Release Version 5 Not Supported error in IntelliJ

What do you do when you create a new Maven Java project, and when you run it, you get the following error:

Error:java: error: release version 5 not supported

Sometimes the error could also read as follows:

java: Source option 5 is no longer supported. Use 6 or later.

Luckily for us, the solution is exactly the same!

Solution#

Open the project’s pom.xml file and add the following snippet:

Now open the Maven side-panel, and click the Report All Maven Projects button.

You can now successfully run your new Maven Java project.

Additional Notes#

The release version 5 not supported error is quite common with newly created projects.

The java error is frequently seen in IntelliJ after a new Maven project has begun and full setup has not been completed.

By default, the project bytecode version is not actually set in Java maven projects.

Therefore it believes that your current version is set to 5.

Open up Project Settings > Build , Execution …> compiler > java compiler and change your bytecode version to your current java version.

An alternative solution#

If the above does not work for you when trying to solve the java error: release version 5 not supported in IntelliJ, you can attempt the following alternative:

  1. Open the IntelliJ preferences dialog.
  2. Filter the navigation items by typing compiler .
  3. Move to the Maven->Java Compiler section.
  4. In the right hand configuration panel, there is a list of modules and their accompanying Java compile versions. This is called the target bytecode version .
  5. Finally select a version bigger than 1.5.

Note that if there is no version greater than 1.5 available in the above list, then you will need to upgrade your Java Development Kit (JDK) on the local machine.

Once all of these steps have been completed, you may also want to go to the Project Structure contextual menu and select Modules . Under here you will have the option to change each of the module’s language level .

You can also always just update your pom.xml to contain the following:

This will fix your java: error: release version 5 not supported problem encountered while trying to run, or execute a Maven Java application in IntelliJ IDEA.

  1. How to Reverse an Integer in Java
  2. Reverse a String in-place using Java
  3. Check if a Java array Contains Duplicates
  4. The Array Height Checker Problem in Java
  5. Find the Squares of a Sorted Array in Java
  6. Sorting a Java Array by Parity
  7. Remove Duplicates from Sorted Array in Java
  8. Replace Elements with Greatest Element on Right Side using Java
  9. The Valid Mountain Array Problem using Java
  10. Find Numbers with Even Number of Digits using Java

Источник

Introduction

When we create Maven projects using artifacts and try to run them, we sometimes get the following error. Source option 5 is no longer supported. Use 7 or later. In this post, let’s see the steps involved to fix the error in the Maven project.

The error (Source option 5 is no longer supported) is common when we create a Maven project from the old archetypes. In this case, we need to specify the source and target version to the Maven compiler. We can specify these properties in Maven pom.xml file.

Error

[ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Source option 5 is no longer supported. Use 7 or later. [ERROR] Target option 5 is no longer supported. Use 7 or later. [INFO] 2 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.025 s ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 3.1:testCompile (default-testCompile) on project AppiumProject: Compilation failure: Compilation failure: [ERROR] Source option 5 is no longer supported. Use 7 or later. [ERROR] Target option 5 is no longer supported. Use 7 or later.

Source option 5 is no longer supported

Fix

The fix for the problem is to use the latest Java environment for the project that is above JDK 7 or Later.

Identify the JDK version installed on your machine or the version the IDE workspace uses. Update the project build path with the latest library settings.

1.5 Java Compiler

Right-click Project properties >> Java Compiler.

Change the JDK compliance parameters from 1.5 -> 1.7 or above.

Click on the Execution Environments link and select the latest or suitable JDK above JDK 1.7

Java Execution Environments

Click on Apply and Close button.

Maven POM.xml

Follow the below steps to avoid this error in the Maven project,

  • Check the Java compiler version. (Project-specific settings)
  • Workspace settings. (Configure Workspace settings)
  • Project build path.
  • Maven POM.xml build file.

Jenkins Error Source and Target

Examples

For example, to specify JDK 8 we can add the properties like the below to the POM.xml file:

JDK 14

Change the Java compiler and the project build path. After the changes specify the JDK version in the POM.xml Maven build file.

For example, specify the JDK 14 to the Maven pom.xml.

source option 5 is no longer supported

Sample pom.xml file

Sample pom.xml file with JDK 14 version

 4.0.0 com.testingdocs TestNGTutorials 0.0.1-SNAPSHOT 14 14   org.seleniumhq.selenium selenium-java 4.0.0-alpha-7  org.seleniumhq.selenium selenium-firefox-driver 4.0.0-alpha-7  org.seleniumhq.selenium selenium-edge-driver 4.0.0-alpha-7  org.testng testng 6.8      org.apache.maven.plugins maven-surefire-plugin 3.0.0-M5     

Verify the fix

Run the Maven project. The error should be fixed now.

After changing the settings and adding the properties information to the pom.xml file. Verify by running the project. In Eclipse IDE, to build the project choose the option

Maven Tutorial

Maven tutorial on this website:

For more information on the Maven build tool, visit the official website:

Источник

Error java source option 5 is no longer supported use 6 or later intellij idea

What do you do when you create a new Maven Java project, and when you run it, you get the following error:

Error:java: error: release version 5 not supported

Sometimes the error could also read as follows:

java: Source option 5 is no longer supported. Use 6 or later.

Luckily for us, the solution is exactly the same!

Solution

Open the project’s pom.xml file and add the following snippet:

Now open the Maven side-panel, and click the Report All Maven Projects button.

You can now successfully run your new Maven Java project.

Additional Notes

The release version 5 not supported error is quite common with newly created projects.

The java error is frequently seen in IntelliJ after a new Maven project has begun and full setup has not been completed.

By default, the project bytecode version is not actually set in Java maven projects.

Therefore it believes that your current version is set to 5.

Open up Project Settings > Build , Execution …> compiler > java compiler and change your bytecode version to your current java version.

An alternative solution

If the above does not work for you when trying to solve the java error: release version 5 not supported in IntelliJ, you can attempt the following alternative:

  1. Open the IntelliJ preferences dialog.
  2. Filter the navigation items by typing compiler .
  3. Move to the Maven->Java Compiler section.
  4. In the right hand configuration panel, there is a list of modules and their accompanying Java compile versions. This is called the target bytecode version .
  5. Finally select a version bigger than 1.5.

Note that if there is no version greater than 1.5 available in the above list, then you will need to upgrade your Java Development Kit (JDK) on the local machine.

Once all of these steps have been completed, you may also want to go to the Project Structure contextual menu and select Modules . Under here you will have the option to change each of the module’s language level .

You can also always just update your pom.xml to contain the following:

This will fix your java: error: release version 5 not supported problem encountered while trying to run, or execute a Maven Java application in IntelliJ IDEA.

Introduction

When we create Maven projects using artifacts and try to run them, we sometimes get the following error. Source option 5 is no longer supported. Use 7 or later. In this post, let’s see the steps involved to fix the error in the Maven project.

The error (Source option 5 is no longer supported) is common when we create a Maven project from the old archetypes. In this case, we need to specify the source and target version to the Maven compiler. We can specify these properties in Maven pom.xml file.

Error

[ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Source option 5 is no longer supported. Use 7 or later. [ERROR] Target option 5 is no longer supported. Use 7 or later. [INFO] 2 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.025 s ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin: 3.1:testCompile (default-testCompile) on project AppiumProject: Compilation failure: Compilation failure: [ERROR] Source option 5 is no longer supported. Use 7 or later. [ERROR] Target option 5 is no longer supported. Use 7 or later.

Source option 5 is no longer supported

Fix

The fix for the problem is to use the latest Java environment for the project that is above JDK 7 or Later.

Identify the JDK version installed on your machine or the version the IDE workspace uses. Update the project build path with the latest library settings.

1.5 Java Compiler

Right-click Project properties >> Java Compiler.

Change the JDK compliance parameters from 1.5 -> 1.7 or above.

Click on the Execution Environments link and select the latest or suitable JDK above JDK 1.7

Java Execution Environments

Click on Apply and Close button.

Maven POM.xml

Follow the below steps to avoid this error in the Maven project,

  • Check the Java compiler version. (Project-specific settings)
  • Workspace settings. (Configure Workspace settings)
  • Project build path.
  • Maven POM.xml build file.

Jenkins Error Source and Target

Examples

For example, to specify JDK 8 we can add the properties like the below to the POM.xml file:

JDK 14

Change the Java compiler and the project build path. After the changes specify the JDK version in the POM.xml Maven build file.

For example, specify the JDK 14 to the Maven pom.xml.

source option 5 is no longer supported

Sample pom.xml file

Sample pom.xml file with JDK 14 version

 4.0.0 com.testingdocs TestNGTutorials 0.0.1-SNAPSHOT 14 14   org.seleniumhq.selenium selenium-java 4.0.0-alpha-7  org.seleniumhq.selenium selenium-firefox-driver 4.0.0-alpha-7  org.seleniumhq.selenium selenium-edge-driver 4.0.0-alpha-7  org.testng testng 6.8      org.apache.maven.plugins maven-surefire-plugin 3.0.0-M5     

Verify the fix

Run the Maven project. The error should be fixed now.

After changing the settings and adding the properties information to the pom.xml file. Verify by running the project. In Eclipse IDE, to build the project choose the option

Maven Tutorial

Maven tutorial on this website:

For more information on the Maven build tool, visit the official website:

Источник

Читайте также:  Php script that login
Оцените статью