目标版本无效:1.7 [英] invalid target release: 1.7

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

问题描述

我见过类似的问题,但还没有找到答案。

I have seen similar questions, but haven't yet found the answer.

使用maven编译,我得到:

Using maven compile, I get:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project api: Fatal error compiling: invalid target release: 1.7 -> [Help 1]

这是pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.0</version>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
        <encoding>UTF-8</encoding>
    </configuration>
</plugin>

Javac版本:

javac 1.7.0_25

Java版本:

java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

知道它可能是什么?

推荐答案

您需要将JAVA_HOME设置为jdk7主目录,例如在Microsoft Windows上:

You need to set JAVA_HOME to your jdk7 home directory, for example on Microsoft Windows:


  • C:\Program Files\Java\jdk1.7.0_40

或OS X:


  • /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home

这篇关于目标版本无效:1.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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