To test the read operations on certificates in various formats, I wrote a very simple test class, but the following error occurs:
Java. Lang. unsupportedclassversionerror: bad version number in. Class File
At java. Lang. classloader. defineclass1 (native method)
At java. Lang. classloader. defineclass (unknown source)
At java. Security. secureclassloader. defineclass (unknown source)
At java.net. urlclassloader. defineclass (unknown source)
At java.net. urlclassloader. Access $100 (unknown source)
At java.net. urlclassloader $ 1.run( unknown source)
At java. Security. accesscontroller. doprivileged (native method)
At java.net. urlclassloader. findclass (unknown source)
At java. Lang. classloader. loadclass (unknown source)
At sun. Misc. launcher $ appclassloader. loadclass (unknown source)
At java. Lang. classloader. loadclass (unknown source)
At java. Lang. classloader. loadclassinternal (unknown source)
It was found thatThe versions of Java compile level and specified compiled JRE are inconsistent.;
For example, I specified version 1.5 in installed JRE and 6.0 in compile level. This type of problem usually occurs in some environments where 6.0 is required, while in some environments, 5.0 is required, when the environment is switched, the preceding two parameters are not modified together;
The solution is to set the two to the same and recompile them;