java -jar 启动时报错:Unsupported major.minor version 52.0 异常解决记录

D:\IDEA_CODE\springboot-xuexi\cloud-eureka-client\target>java -jar cloud-eureka-clie
nt-0.0.1-SNAPSHOT.jar --server.port=10101
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/example/eurek
a/client/EurekaClientApplication : 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 org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(Launched
URLClassLoader.java:94)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)

D:\IDEA_CODE\springboot-xuexi\cloud-eureka-client\target>

高版本JDK编译的class不能在低版本的jvm虚拟机下运行

出现这个问题是本机的JDK环境变量配置错了,我安装了jdk1.7和1.8两个版本,环境变量中配置的1.7, 而开发工具IDE中我配置的1.8,所以用java -jar 启动的时候报错Unsupported major.minor version 52.0

你可能感兴趣的:(java -jar 启动时报错:Unsupported major.minor version 52.0 异常解决记录)