I have the task to create the spring-boot application using Java 7.
So, as usual, I created a template on start.spring.io resource and open him via File -> New -> Project from Existing Sources...
When I run with jdk-8
, everything works fine, but when I change JDK to version 1.7 (also I change java-version
in pom.xml
) I get a compilation error:
Error:java: invalid flag: -parameters
<?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 http://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.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.exercise</groupId>
<artifactId>quadratic</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>quadratic</name>
<description>Demo project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</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-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I have no created any classes in this project.
-parameters
is new feature introduced in java 1.8. The error is expected when it is used in java 1.7.
So please update java version to 1.8 if you want this feature.
Spring Boot 2.1 requires Java 8 as per the documentation:
Spring Boot 2.1.2.RELEASE requires Java 8 and is compatible up to Java 11 (included). Spring Framework 5.1.4.RELEASE or above is also required.
You must downgrade to Spring Boot 1.5 if you plan to use Java 7, as per the documentation:
Spring Boot 1.5.19.RELEASE requires Java 7 and Spring Framework 4.3.22.RELEASE or above. You can use Spring Boot with Java 6 with some additional configuration. See Section 85.11, “How to use Java 6” for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With