Exception in thread main Java.lang.UnsopportedClassVersionError solution

Source: Internet
Author: User

Let me give you an account of the background:

(1) write the code of the notebook JDK version is 1.8, packaged jar is running normally;

(2) The version of the server (target) that is packaged as a jar running is 1.6;

Install (1) packaged jar package on the server, double-click or Java-jar **.jar command can not be used normally, whether the environment variable or double-click the settings (Reference blog) have tried, in the use of the command line appeared in the problem of abnormal error, "Exception in thread Main Java.lang.UnsopportedClassVersionError "only to know that the JDK version of the two machines is inconsistent, as shown in the following figure.


Solution:

1, modify the JDK version of the Code editing machine, 2, reinstall the server JDK version. The 1th approach is easy to implement

(1) eclipse--Select the project to export, right click to select Properties


(2) In the Java Compiler (Java compiler) to modify the JDK version, my default version is 1.8, change it to 1.6 (consistent with the server version), click OK, repackaged into a jar package, and then put on the server does not appear above the problem.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.