Spring boot 启动报错 Unsupported major.minor version 52.0

#Spring boot 启动报错 Unsupported major.minor version 52.0

问题描述

在创建spring boot hello world 工程时候启动报错, Unsupported major.minor version 52.0。

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/yf/springboot/Application : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
	

工程描述

pom文件如下:

  
<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.0modelVersion>  
    <groupId>com.yf.springbootgroupId>  
    <artifactId>spring-boot-helloartifactId>  
    <version>0.0.1-SNAPSHOTversion>  
      
    <parent>  
        <groupId>org.springframework.bootgroupId>  
        <artifactId>spring-boot-starter-parentartifactId>  
       
        <version>1.4.1.RELEASEversion>
    parent>  
  	<properties>
  		<project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
  		<java-version>1.7java-version>
  	properties>
  	
      
    <dependencies>  
    
        <dependency>  
            <groupId>org.springframework.bootgroupId>  
            <artifactId>spring-boot-starter-webartifactId>  
            
        dependency> 
        
         <dependency>  
            <groupId>com.alibabagroupId>  
            <artifactId>fastjsonartifactId>  
            <version>1.2.15version>
        dependency> 
         
    dependencies>  
  
      
    <build>  
        
             
        
             <plugins>
            <plugin>  
                <groupId>org.springframework.bootgroupId>  
                <artifactId>spring-boot-maven-pluginartifactId>  
                <dependencies>
                	<dependency>
                		<groupId>org.springframeworkgroupId>
                		<artifactId>springloadedartifactId>
                		<version>1.2.3.RELEASEversion>
                	dependency>
                dependencies>
                <executions>
                	<execution>
                		<goals>
                			<goal>repackagegoal>
                		goals>
                	execution>
                	
                executions>
                <configuration>
                	<classifier>execclassifier>
                configuration>
            plugin>  
        plugins>  
    build>  
  
      
      
    
project>  

Spring boot 启动报错 Unsupported major.minor version 52.0_第1张图片

最后根据报错描述,和网上了解,出错是因为Spring boot 版本的许多jar包 依赖JDK1.8,所以启动时候会报错,类似不支持jdk版本的提示。只要换上JDK8 环境就可以啦。

因为本人Eclipse 是最新版本的依赖jdk1.8,所以不需要安装jdk8。所以再eclipse更还jre换班即可。
更换操作如下:
1、build path

这里写图片描述

2、add library
Spring boot 启动报错 Unsupported major.minor version 52.0_第2张图片

3、select jdk version
Spring boot 启动报错 Unsupported major.minor version 52.0_第3张图片

4、maven update - 重新编译项目
Spring boot 启动报错 Unsupported major.minor version 52.0_第4张图片

经过上诉步骤操作,成功启动spring boot hello world 程序。

你可能感兴趣的:(spring-boot,Spring,Boot实战学习)