Java 1.7中的无效标志-参数 [英] Invalid flag -parameters in java 1.7

查看:69
本文介绍了Java 1.7中的无效标志-参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是使用Java 7创建spring-boot应用程序.

I have the task to create the spring-boot application using Java 7.

因此,像往常一样,我在start.spring.io资源上创建了一个模板,然后通过File -> New -> Project from Existing Sources...

So, as usual, I created a template on start.spring.io resource and open him via File -> New -> Project from Existing Sources...

当我使用jdk-8运行时,一切正常,但是当我将JDK更改为1.7版(也在pom.xml中也更改了java-version)时,我得到了编译错误:

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:

错误:java:无效标志:-参数

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是Java 1.8中引入的新功能.在Java 1.7中使用该错误是预期的.

-parameters is new feature introduced in java 1.8. The error is expected when it is used in java 1.7.

因此,如果需要此功能,请将Java版本更新为1.8.

So please update java version to 1.8 if you want this feature.

这篇关于Java 1.7中的无效标志-参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆