Command-line compiled class files generate Unsupportedclassversionerror solutions on MyEclipse servers

Source: Internet
Author: User

Let's say we've compiled the Java file into a class file on the command line . And then put it on the Tomcat Server, we can see the following information on the server's console

One of the things we care about is

Severity: Exception Invoking periodic operation:

java.lang.UnsupportedClassVersionError:FirstServlet2:Unsupported Major.minor version 52.0 (unable to load class firsts Ervlet2)

At this time I access the original in the folder through the browser I can access the file will be an error.

That is to say, I have stored the path of the class file//localhost/linshaolong that all the files in my Web-inf's outer folder cannot be accessed by the browser, and I initially decided to add the class file causes the entire folder to not be configured inside the server

Then we look back java.lang.UnsupportedClassVersionError this error, roughly meaning that the Calss file version error is not supported. Check it out. A Java class file that is compiled by a high version of the JDK attempts to run the resulting error on a lower version of the JVM.

Through java-version, I found out that the JDK version of my command line is 1.8.0-65

The JDK version of the configuration server that opened my myeclipse is jdk7. It is because the server is running a version of the JDK that is too low that the deployment is unsuccessful.

Then we have two ways to solve this problem:

1. Find a myeclipse version of Jdk8 above (live in a dream)

2. Put the Java file in the MyEclipse and compile it.

That is, drag the Java file to the project, save it, and then go to the folder that holds the class file. (If you start the manual code Java file is the default package, it will be placed in the MyEclipse project under the default package saved.) )

Then put the compiled class file back into the original Web-inf's Classes folder. Match the path to Web. Xml.

And then you find that you can run it.

Well. That's pretty much what it is. Think of adding ...

Command-line compiled class files generate Unsupportedclassversionerror solutions on MyEclipse servers

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.