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