Tips On Solving The Problem “Error:java: invalid target release: 11”

Java is one of the most used programming languages globally, and it is used in a wide range of application development. However, there are situations when you run into an error that is not easy to deal with. 

Sometimes, these errors are cryptic, so finding an effective solution is hard. This blog has some useful tips on how to resolve the error “Error:java: invalid target release: 11“.

Tips On Solving The Problem “Error:java: invalid target release: 11”

When attempting to create your application in IntelliJ, you may encounter the following issue.

Information:java: Errors occurred while compiling module ‘test-domain_main’

Information: javac 1.8.0_171 was used to compile java sources

Information:1/10/2019 4:21 PM – Compilation completed with 1 error and 0 warnings in 1s 199ms Error:java: invalid target release: 11

To deal with this problem, you should set the Language level to 10 in File=>Project Structure=>Modules. Additionally, look at File => Settings => Build, Execution, Deployment => Compiler => Java Compiler=>>Project bytecode and Per-module bytecode versions. There are 11. In pom.xml file 1.8, the second option is to adjust the Java version from 11 to 8. Navigate to File => Settings => Build, Execution, and Deployment => Compiler => Java Compiler. 

Here, your project is mentioned in the Module column, and in the Target bytecode version column, the Java version for the project has been defined (usually 11), modify it to 8. Navigate to the File => Project Structure => Modules menu. In the Source tab, you can see the Language level option, where you may select 8 – Lambdas, type annotations, and so on. Finally, select Apply, and OK, then you’re ready to go.

Option 1: Configure IntelliJ IDEA

Simply make these two changes, and your problem will be resolved.

  1. Firstly, in Intellij IDEA, choose File.
  2. Then, choose Project Structure.
  3. Select Modules.
  4. Next, change the Language level to 8.
  5. In IntelliJ IDEA, choose File.
  6. Choose Settings.
  7. Select Build, Execution, and Deployment.
  8. Select Compiler.
  9. Choose Java Compiler.
  10. Pick 8 and 8 will also be available.
  11. Your problem should now be resolved.

Option 2: Complete the following steps.

  1. To fix this problem, set the language level to 10 in File=>Project Structure=>Modules.
  2. Additionally, choose File => Settings => Build, Execution, Deployment => Compiler => Java Compiler =>> Project bytecode and Per-module bytecode versions. There are 11.

Option 3: Implement this solution.

  1. Adjust the Java version from 11 to 8 in the pom.xml file java.version>1.8/java.version>.
  2. Navigate to File => Settings => Build, Execution, Deployment => Build, Execution, Deployment =>=> Compiler Compiler for Java
  3. Next, the project is mentioned in the Module column, and in the Target bytecode version column, the Java version for such project is already defined (usually 11), modify it to 8.
  4. Navigate to the File => Project Structure => Modules menu. In the Source tab, you could see the Language level selection, where you may select 8 – Lambdas, type annotations, and so on. Lastly, select Apply and OK, and you’re done.

Conclusion

We hope you enjoyed our blog post on how to solve the bug “Error:java: invalid target release: 11“. Please leave a comment if you have any further questions or concerns regarding installing pip on your machine. Thank you for taking the time to read; we are always delighted anytime one of our pieces can give important information on this topic!


Related Articles

Scroll to Top