When launching a jar package using the Java-jar command, the prompt version does not support:
1[Email protected] eureka-server-master]# java-jar xuebusi-eureka-server-master.jar 2 Exception in thread "main" java.lang.UnsupportedClassVersionError: com/xuebusi/ Eurekaapplication:
Unsupported Major.minor version 52.0 3 At Java.lang.ClassLoader.defineClass1 (Native Method)4At Java.lang.ClassLoader.defineClass (Classloader.java: -)5At Java.security.SecureClassLoader.defineClass (Secureclassloader.java:142)6At Java.net.URLClassLoader.defineClass (URLClassLoader.java:449)7At java.net.urlclassloader.access$ -(URLClassLoader.java: in)8At java.net.urlclassloader$1. Run (URLClassLoader.java:361)9At java.net.urlclassloader$1. Run (URLClassLoader.java:355)Ten At java.security.AccessController.doPrivileged (Native Method) OneAt Java.net.URLClassLoader.findClass (URLClassLoader.java:354) AAt Java.lang.ClassLoader.loadClass (Classloader.java:425) -At Org.springframework.boot.loader.LaunchedURLClassLoader.loadClass (Launchedurlclassloader.java:94) -At Java.lang.ClassLoader.loadClass (Classloader.java:358) theAt Org.springframework.boot.loader.MainMethodRunner.run (Mainmethodrunner.java: $) -At Org.springframework.boot.loader.Launcher.launch (Launcher.java: the) -At Org.springframework.boot.loader.Launcher.launch (Launcher.java: -) -At Org.springframework.boot.loader.JarLauncher.main (Jarlauncher.java:Wuyi) +[Email protected] eureka-server-master]#
This is because the JDK version is too low (I use MAVEN to hit the jar with the 1.8 version of the JDK, and I use Java-jar to run the jar package when the JDK installed on the server is version 1.7):
similar errors are in the Java version of the problem, that is, the JDK version is too low, just choose the corresponding JDK version compiled. -, the, -,Wuyi, theis the version number inside the Java compiler: unsupported Major.minor version52.0Corresponds to JDK1.8(JRE1.8) Unsupported Major.minor version51.0Corresponds to JDK1.7(JRE1.7) Unsupported Major.minor version50.0Corresponds to JDK1.6(JRE1.6) Unsupported Major.minor version49.0Corresponds to JDK1.5(JRE1.5) Unsupported Major.minor version48.0Corresponds to JDK1.4(JRE1.4)
Resolution version: Unified JDK version, the JDK version of the jar package is consistent with the JDK version that is used to run the JDK.
Modify the JDK version in the Maven. pom.xml file to 1.7, and then re-hit the jar package.
Using the "Java-jar" command again to start the jar package, there is no longer a version issue.
If this article is helpful to you, please scan the QR code below to reward, your encouragement is my greatest encouragement!
Use the "Java-jar" command to start a JDK version exception that is not supported by the jar pack times