Error java error release version 5 not supported как исправить

Такая проблем уже не впервые, не помню как получилось решить, вроде бы новый проект создавал. Крч есть класс, есть метод main() и есть System.out.println("Hello"); При вызове мейна выбивает ошибку

Если используете IntelijIDEA, то внимательно проверяйте, что у Вас настроено в Project Structure:

Project Structure >> Project >> Project SDK;
Project Structure >> Project >> Project language level;
Project Structure >> Modules >> Dependencies >> Module SDK;
Project Structure >> Modules >> Sources;
Project Structure >> SDKs;

Потому что ошибка java: error: release version 5 not supported может возникать, когда версия компилятора в настройках IDE:

File >> Settings >> Build, Execution, Deployment >> Compiler >> Java Compiler >> project bytecode version >> Per-module bytecode version

не совпадает с той, что указана в Project Structure.

Кроме того, если Вы собираете Jar и успешно сбилдили артефакты, проверьте, чтобы в Run/Debug Configurations версия JRE по дефолту также соответствовала версии проекта.

Если используете сборщик Maven, то можете с помощью POM изменить явно версию проекта, написав такие строчки:

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

Или же в плагине:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Иногда настройки в Project Structure и версия компилятора могут сбиваться, поэтому перед очередной сборкой проверяйте, чтобы всё соответствовало Вашей основной версии проекта.

Angie Jones

A common error in IntelliJ when attempting to run a new Java maven project is Error:java: release version 5 not supported.

Here are 3 techniques to resolve this. Try them in order. If one doesn’t resolve the issue, try the next.

1. Update Java Compiler

  • Go to IntelliJ IDE menu item (or File on Windows) -> Preferences -> Build, Execution, Deployment -> Java Compiler

  • Delete value under Target bytecode version, then click OK

  • Refresh maven

  • Try running again. If problem persists, continue on to number 2 below

2. Update SDK Version

  • Go to File -> Project Structure -> Project Settings -> Project. Make sure you have the correct Java version selected. It should be the same as the one you downloaded

  • Also on this same panel, go to Platform Settings -> SDKs. Make sure you have the correct Java version selected

  • Click OK

  • Refresh maven

  • Try running again. If problem persists, continue on to number 3 below

3. Add property to pom.xml

  • Within IntelliJ, open pom.xml file

  • Add this section before <dependencies> (If your file already has a <properties> section, just add the <maven.compiler...> lines below to that existing section):

   <properties> 
      <maven.compiler.source>1.8</maven.compiler.source> 
      <maven.compiler.target>1.8</maven.compiler.target> 
   </properties>

Enter fullscreen mode

Exit fullscreen mode

  • Change the x in 1.8 to your Java version. For example, if you’re using Java 13, change 1.8 to 1.13

  • Refresh maven

  • Try running again

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:

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

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:

<properties>
   <java.version>11</java.version>
</properties>

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.

Hello Guys, How are you all? Hope You all Are Fine. Today I am just trying to run my simple java maven project in my IntelliJ IDEA Ultimate And I am facing the following error Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

Contents

  1. How Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate Occurs ?
  2. How To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate?
  3. Solution 1: Change target bytecode version
  4. Solution 2: Add this code in build plugin in POM file
  5. Solution 3 : try to change the Java version
  6. Summery

Today I am just trying to run my simple java maven project in my IntelliJ IDEA Ultimate And I am facing the following error.

Error:java: error: release version 5 not supported

How To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate?

  1. How To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate?

    To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate Open Your IDE Setting. Then Open Build Execution, Deployment Then Select Compiler. Then Just Scroll down to Maven and java compile In the right panel will be a list of modules and their associated java compile version “target bytecode version.” Select a version >1.5. You may need to upgrade your JDK if one is not available. Preferences > Build, Execution, Deployment > Compiler > Java Compiler > Target bytecode version. Setting this value fixed the error for me

  2. Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate

    To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate Open Your IDE Setting. Then Open Build Execution, Deployment Then Select Compiler. Then Just Scroll down to Maven and java compile In the right panel will be a list of modules and their associated java compile version “target bytecode version.” Select a version >1.5. You may need to upgrade your JDK if one is not available. Preferences > Build, Execution, Deployment > Compiler > Java Compiler > Target bytecode version. Setting this value fixed the error for me

Solution 1: Change target bytecode version

  1. Open Your IDE Setting.
  2. Then Open Build Excecution, Deployment
  3. Then Select Compiler.
  4. Then Just Scroll down to Maven and java compile
  5. In the right panel will be a list of modules and their associated java compile version “target bytecode version.”
  6. Select a version >1.5.
  7. You may need to upgrade your jdk if one is not available.
  8. Preferences > Build, Execution, Deployment > Compiler > Java Compiler > Target bytecode version. Setting this value fixed the error for me

Solution 2: Add this code in build plugin in POM file

 <properties>
        <java.version>1.8</java.version>
        <maven.compiler.version>3.8.1</maven.compiler.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Solution 3 : try to change the Java version

Here First of all set the language level/release versions in pom.xml Like this.

<properties>
  <maven.compiler.source>1.8</maven.compiler.source>
  <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Then Just try to change the Java version.

  1. Go to File -> Select Project structure -> Select Project -> Then Project SDK -> set It to 11
  2. Go to File -> Select Project structure -> Select Project -> Select Project language level  -> set to 11
  3. Go to File -> Select Project structure -> Select Project -> Select Modules -> select Sources  -> set it to 11
  4. Go to setting -> Open Build, Execution, Deployment -> Slect Compiler -> Then select Java Compiler -> Change Project bytecode version to 11
  5. Go to setting -> Open Build, Execution, Deployment -> Slect Compiler -> Then select Java Compiler -> Select Module -> Change it to 11

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

  • SyntaxError: invalid syntax to repo init in the AOSP code.

Содержание

UnsupportedClassVersionError
java: error: release version 5 not supported
unmappable character (0x8F) for encoding windows-1252
Другие статьи о Java

Введение

UnsupportedClassVersionError

Error: A JNI error has occurred, please check your installation and try again
Exception in thread «main» java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
Agent JVM has terminated. Exit code=1

Эта ошибка часто возникает при использовании

Jenkins

версии 2.357 и выше
с работниками на которых установлена восьмая Java. Проверьте версию Java на хосте работника, если
вы подключаете его напрямую и в

Dockerfile

если вы используете работников в

Docker
что является более новым подходом.

java: error: release version 5 not supported

Эта ошибка говорит о том, что вы используете SDK выше 8 а байткод в
который пытаетесь скомпилировать — версии 5.

После восьмой версии Java байткод пятой версии уже не поддерживается.
Это одна из причин по которой версия 8 считается наиболее
«стабильной»

Я не советую менять SDK на 8, лучше поменять target bytecode.

В

IntelliJ IDEA

это можно сделать следующим образом

File → Settings → Build, Execution, Deployment → Compiler
→ Target bytecode version → 14

14 выбирать не обязательно, но вам явно будет нужно что-то выше 5

error: unmappable character (0x8F) for encoding windows-1252

Если у вас в коде комментарии на русском и при компиляции появляется

error: unmappable character (0x8F) for encoding windows-1252

Похожие статьи

Программирование на Java
Установка Java
Intellij
Компиляция и запуск Java кода
final
switch
Определить тип переменной
Генератор случайных чисел
Импорт из других классов
Ошибки
Maven
JUnit

Если используете IntelijIDEA, то внимательно проверяйте, что у Вас настроено в Project Structure:

Project Structure >> Project >> Project SDK;
Project Structure >> Project >> Project language level;
Project Structure >> Modules >> Dependencies >> Module SDK;
Project Structure >> Modules >> Sources;
Project Structure >> SDKs;

Потому что ошибка java: error: release version 5 not supported может возникать, когда версия компилятора в настройках IDE:

File >> Settings >> Build, Execution, Deployment >> Compiler >> Java Compiler >> project bytecode version >> Per-module bytecode version

не совпадает с той, что указана в Project Structure.

Кроме того, если Вы собираете Jar и успешно сбилдили артефакты, проверьте, чтобы в Run/Debug Configurations версия JRE по дефолту также соответствовала версии проекта.

Если используете сборщик Maven, то можете с помощью POM изменить явно версию проекта, написав такие строчки:

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

Или же в плагине:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Иногда настройки в Project Structure и версия компилятора могут сбиваться, поэтому перед очередной сборкой проверяйте, чтобы всё соответствовало Вашей основной версии проекта.

Понравилась статья? Поделить с друзьями:
  • Error java source option 5 is no longer supported use 6 or later
  • Error java outofmemoryerror insufficient memory
  • Error java net unknownhostexception unable to resolve host
  • Error java lang verifyerror inconsistent stackmap frames at branch target 47
  • Error java awt