ankitdixit
New Member
- Joined
- Feb 2, 2022
- Messages
- 3
Hello Everyone, I a new to programming and learning Java. I am trying to package a Java Spring Boot application. When I use the command "mvnw package" I get the following error:
From reading online, I learnt that there is an issue with me using older Java version.
File version 55.0 is Java 11 and version 52.0 is Java 8.
I tried updating the Java version using the "Check for updates program". So that is fine.
When I run the "java -version" command I get the following:
I then tried to change the project settings on Eclipse:
Java Build Path -> Libraries -> JRE System Library [jdk-15]
Java Compiler -> Compiler Compliance Level - 14
The POM file is a below:
Not sure where I am going wrong. Can anyone suggest me?
Code:
/watchlist/WatchlistApplicationTests 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
From reading online, I learnt that there is an issue with me using older Java version.
File version 55.0 is Java 11 and version 52.0 is Java 8.
I tried updating the Java version using the "Check for updates program". So that is fine.
When I run the "java -version" command I get the following:
Code:
openjdk version "11.0.8" 2020-07-14 LTS OpenJDK Runtime Environment Corretto-11.0.8.10.1 (build 11.0.8+10-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.8.10.1 (build 11.0.8+10-LTS, mixed mode)
I then tried to change the project settings on Eclipse:
Java Build Path -> Libraries -> JRE System Library [jdk-15]
Java Compiler -> Compiler Compliance Level - 14
The POM file is a below:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.openclassrooms</groupId>
<artifactId>watchlist</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>watchlist</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Not sure where I am going wrong. Can anyone suggest me?