Oop! Spring Boot : Unsupported major.minor version 52.0

2016/12 01 13:12
此文章不得转载,如有需要请联系网站管理员。

一度的温暖,一百度的爱情,来自于sbf999胜博发pt娱乐老虎机的点点滴滴

我根据官偏导游中断spring-boot的学习,我配置好了pom.xml文件

<?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>

    <groupId>com.example</groupId>
    <artifactId>myproject</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <!-- Inherit defaults from Spring Boot -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.BUILD-SNAPSHOT</version>
    </parent>

    <!-- Add typical dependencies for a web application -->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <!-- Package as an executable jar -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <!-- Add Spring repositories -->
    <!-- you dont need this if you are using a .RELEASE version -->
    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <url>http://repo.spring.io/snapshot</url>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <url>http://repo.spring.io/milestone</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <url>http://repo.spring.io/snapshot</url>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <url>http://repo.spring.io/milestone</url>
        </pluginRepository>
    </pluginRepositories>
</project>

我的java版本和maven版本辨别是1.7和3.3.9

然后我根据官方文档中断maven的编译以及运转,编译没有任何题目,但是当我运用下令

mvn spring-boot:run

后报错

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/springframework/boot/SpringApplication : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1Native Method
    at java.lang.ClassLoader.defineClassUnknown Source
    at java.security.SecureClassLoader.defineClassUnknown Source
    at java.net.URLClassLoader.defineClassUnknown Source
    at java.net.URLClassLoader.access$100Unknown Source
    at java.net.URLClassLoader$1.runUnknown Source
    at java.net.URLClassLoader$1.runUnknown Source
    at java.security.AccessController.doPrivilegedNative Method
    at java.net.URLClassLoader.findClassUnknown Source
    at java.lang.ClassLoader.loadClassUnknown Source
    at sun.misc.Launcher$AppClassLoader.loadClassUnknown Source
    at java.lang.ClassLoader.loadClassUnknown Source
    at Example.mainExample.java:16

我实行在网上查找缘由可以是JDK版本的题目,但是我的配置JDK曾经是1.7了

Help!!!

要看的是编译版本。

你好,我也遇到了异样的题目,我的jdk和maven版本和你的如出一辙,讨教你处理了这个题目吗???

我又弄了下,
把官方文档给出的pom.xml中的 spring-boot-starter-parent 版本调低到1.4.0就行了。

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.BUILD-SNAPSHOT</version>
</parent>

修正为:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.0.RELEASE</version>
</parent>

在pom中运用指定的JDK中断编译

<build>
    <plugins>
        <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>
    </plugins>
</build>

(看完/读完)这篇文章有何感想! 来看看sbf999胜博发pt娱乐老虎机是怎么评论的吧!

--转载请注明: sbf999胜博发老虎机_胜博发娱乐老虎机_sbf999胜博发pt娱乐老虎机 » Oop! Spring Boot : Unsupported major.minor version 52.0

发表评论

(必填)