major.minor version:代表java版本的主次版本号,具体参考博客 http://blog.youkuaiyun.com/xiaxiaorui2003/article/details/4327029
试用Lucene6.3.0 版本时遇到以下问题:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/lucene/index/IndexReader : Unsupported major.minor version 52.0
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.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 com.fomagic.lucene.Main.main(Main.java:31)
参考网上文章以及官方说明:
Lucene 6.x 需要 java 8
原因:
高版本jdk编译的class运行在低版本中的运行错误