mongodb - JRE 1.7 and Spark version 2.6.0. having exception java.lang.UnsupportedClassVersionError: spark/Route : Unsupported major.minor version 52.0 -


i using jre 1.7 spark version 2.6.0 , ide intelij idea. source of class below:

package com.tengen;  import spark.request; import spark.response; import spark.route; import spark.spark;  public class helloworldsparkstyle {     public static void main(string[] args) {         spark.get("/",new route() {             @override             public object handle(final request request, final response response) throws exception {                 return "hello world spark";             }         });     } } 

i exception when try run class:

"c:\program files\java\jdk1.7.0_80\bin\java" "-javaagent:c:\program files\jetbrains\intellij idea community edition 2017.2.1\lib\idea_rt.jar=4388:c:\program files\jetbrains\intellij idea community edition 2017.2.1\bin" -dfile.encoding=utf-8 -classpath "c:\program files\java\jdk1.7.0_80\jre\lib\charsets.jar;c:\program files\java\jdk1.7.0_80\jre\lib\deploy.jar;c:\program files\java\jdk1.7.0_80\jre\lib\ext\access-bridge-64.jar;c:\program files\java\jdk1.7.0_80\jre\lib\ext\dnsns.jar;c:\program files\java\jdk1.7.0_80\jre\lib\ext\jaccess.jar;c:\program files\java\jdk1.7.0_80\jre\lib\ext\localedata.jar;c:\program files\java\jdk1.7.0_80\jre\lib\ext\sunec.jar;c:\program files\java\jdk1.7.0_80\jre\lib\ext\sunjce_provider.jar;c:\program files\java\jdk1.7.0_80\jre\lib\ext\sunmscapi.jar;c:\program files\java\jdk1.7.0_80\jre\lib\ext\zipfs.jar;c:\program files\java\jdk1.7.0_80\jre\lib\javaws.jar;c:\program files\java\jdk1.7.0_80\jre\lib\jce.jar;c:\program files\java\jdk1.7.0_80\jre\lib\jfr.jar;c:\program files\java\jdk1.7.0_80\jre\lib\jfxrt.jar;c:\program files\java\jdk1.7.0_80\jre\lib\jsse.jar;c:\program files\java\jdk1.7.0_80\jre\lib\management-agent.jar;c:\program files\java\jdk1.7.0_80\jre\lib\plugin.jar;c:\program files\java\jdk1.7.0_80\jre\lib\resources.jar;c:\program files\java\jdk1.7.0_80\jre\lib\rt.jar;c:\users\naeemj\m101j\target\m101j-1.0-snapshot\web-inf\classes;c:\users\naeemj\.m2\repository\org\springframework\boot\spring-boot-starter-web\1.2.5.release\spring-boot-starter-web-1.2.5.release.jar;c:\users\naeemj\.m2\repository\org\springframework\boot\spring-boot-starter\1.2.5.release\spring-boot-starter-1.2.5.release.jar;c:\users\naeemj\.m2\repository\org\springframework\boot\spring-boot\1.2.5.release\spring-boot-1.2.5.release.jar;c:\users\naeemj\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.2.5.release\spring-boot-autoconfigure-1.2.5.release.jar;c:\users\naeemj\.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.2.5.release\spring-boot-starter-logging-1.2.5.release.jar;c:\users\naeemj\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.12\jcl-over-slf4j-1.7.12.jar;c:\users\naeemj\.m2\repository\org\slf4j\jul-to-slf4j\1.7.12\jul-to-slf4j-1.7.12.jar;c:\users\naeemj\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.12\log4j-over-slf4j-1.7.12.jar;c:\users\naeemj\.m2\repository\ch\qos\logback\logback-classic\1.1.3\logback-classic-1.1.3.jar;c:\users\naeemj\.m2\repository\ch\qos\logback\logback-core\1.1.3\logback-core-1.1.3.jar;c:\users\naeemj\.m2\repository\org\yaml\snakeyaml\1.14\snakeyaml-1.14.jar;c:\users\naeemj\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.4.6\jackson-databind-2.4.6.jar;c:\users\naeemj\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.4.6\jackson-annotations-2.4.6.jar;c:\users\naeemj\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.4.6\jackson-core-2.4.6.jar;c:\users\naeemj\.m2\repository\org\hibernate\hibernate-validator\4.3.2.final\hibernate-validator-4.3.2.final.jar;c:\users\naeemj\.m2\repository\javax\validation\validation-api\1.0.0.ga\validation-api-1.0.0.ga.jar;c:\users\naeemj\.m2\repository\org\jboss\logging\jboss-logging\3.1.0.cr2\jboss-logging-3.1.0.cr2.jar;c:\users\naeemj\.m2\repository\org\springframework\spring-core\4.1.7.release\spring-core-4.1.7.release.jar;c:\users\naeemj\.m2\repository\org\springframework\spring-web\4.1.7.release\spring-web-4.1.7.release.jar;c:\users\naeemj\.m2\repository\org\springframework\spring-aop\4.1.7.release\spring-aop-4.1.7.release.jar;c:\users\naeemj\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;c:\users\naeemj\.m2\repository\org\springframework\spring-beans\4.1.7.release\spring-beans-4.1.7.release.jar;c:\users\naeemj\.m2\repository\org\springframework\spring-context\4.1.7.release\spring-context-4.1.7.release.jar;c:\users\naeemj\.m2\repository\org\springframework\spring-webmvc\4.1.7.release\spring-webmvc-4.1.7.release.jar;c:\users\naeemj\.m2\repository\org\springframework\spring-expression\4.1.7.release\spring-expression-4.1.7.release.jar;c:\users\naeemj\.m2\repository\org\springframework\boot\spring-boot-starter-thymeleaf\1.2.5.release\spring-boot-starter-thymeleaf-1.2.5.release.jar;c:\users\naeemj\.m2\repository\org\thymeleaf\thymeleaf-spring4\2.1.4.release\thymeleaf-spring4-2.1.4.release.jar;c:\users\naeemj\.m2\repository\org\thymeleaf\thymeleaf\2.1.4.release\thymeleaf-2.1.4.release.jar;c:\users\naeemj\.m2\repository\ognl\ognl\3.0.8\ognl-3.0.8.jar;c:\users\naeemj\.m2\repository\org\javassist\javassist\3.18.1-ga\javassist-3.18.1-ga.jar;c:\users\naeemj\.m2\repository\org\unbescape\unbescape\1.1.0.release\unbescape-1.1.0.release.jar;c:\users\naeemj\.m2\repository\nz\net\ultraq\thymeleaf\thymeleaf-layout-dialect\1.2.9\thymeleaf-layout-dialect-1.2.9.jar;c:\users\naeemj\.m2\repository\org\springframework\boot\spring-boot-starter-actuator\1.2.5.release\spring-boot-starter-actuator-1.2.5.release.jar;c:\users\naeemj\.m2\repository\org\springframework\boot\spring-boot-actuator\1.2.5.release\spring-boot-actuator-1.2.5.release.jar;c:\users\naeemj\.m2\repository\org\springframework\boot\spring-boot-legacy\1.0.1.release\spring-boot-legacy-1.0.1.release.jar;c:\users\naeemj\.m2\repository\com\google\appengine\appengine-api-1.0-sdk\1.9.17\appengine-api-1.0-sdk-1.9.17.jar;c:\users\naeemj\.m2\repository\com\github\kernel164\gmultipart\0.4\gmultipart-0.4.jar;c:\users\naeemj\.m2\repository\commons-fileupload\commons-fileupload\1.2.2\commons-fileupload-1.2.2.jar;c:\users\naeemj\.m2\repository\commons-io\commons-io\2.0.1\commons-io-2.0.1.jar;c:\users\naeemj\.m2\repository\com\sparkjava\spark-core\2.6.0\spark-core-2.6.0.jar;c:\users\naeemj\.m2\repository\org\slf4j\slf4j-api\1.7.12\slf4j-api-1.7.12.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\jetty-server\9.2.11.v20150529\jetty-server-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\jetty-http\9.2.11.v20150529\jetty-http-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\jetty-util\9.2.11.v20150529\jetty-util-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\jetty-io\9.2.11.v20150529\jetty-io-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\jetty-webapp\9.2.11.v20150529\jetty-webapp-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\jetty-xml\9.2.11.v20150529\jetty-xml-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\jetty-servlet\9.2.11.v20150529\jetty-servlet-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\jetty-security\9.2.11.v20150529\jetty-security-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\websocket\websocket-server\9.2.11.v20150529\websocket-server-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\websocket\websocket-common\9.2.11.v20150529\websocket-common-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\websocket\websocket-client\9.2.11.v20150529\websocket-client-9.2.11.v20150529.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\websocket\websocket-servlet\9.4.4.v20170414\websocket-servlet-9.4.4.v20170414.jar;c:\users\naeemj\.m2\repository\org\eclipse\jetty\websocket\websocket-api\9.4.4.v20170414\websocket-api-9.4.4.v20170414.jar;c:\users\naeemj\.m2\repository\org\freemarker\freemarker\2.3.26-incubating\freemarker-2.3.26-incubating.jar" com.tengen.helloworldsparkstyle java.lang.unsupportedclassversionerror: spark/route : unsupported major.minor version 52.0     @ java.lang.classloader.defineclass1(native method)     @ java.lang.classloader.defineclass(classloader.java:800)     @ java.security.secureclassloader.defineclass(secureclassloader.java:142)     @ java.net.urlclassloader.defineclass(urlclassloader.java:449)     @ java.net.urlclassloader.access$100(urlclassloader.java:71)     @ java.net.urlclassloader$1.run(urlclassloader.java:361)     @ java.net.urlclassloader$1.run(urlclassloader.java:355)     @ java.security.accesscontroller.doprivileged(native method)     @ java.net.urlclassloader.findclass(urlclassloader.java:354)     @ java.lang.classloader.loadclass(classloader.java:425)     @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308)     @ java.lang.classloader.loadclass(classloader.java:358)     @ java.lang.class.getdeclaredmethods0(native method)     @ java.lang.class.privategetdeclaredmethods(class.java:2625)     @ java.lang.class.getmethod0(class.java:2866)     @ java.lang.class.getmethod(class.java:1676)     @ sun.launcher.launcherhelper.getmainmethod(launcherhelper.java:494)     @ sun.launcher.launcherhelper.checkandloadmain(launcherhelper.java:486) exception in thread "main"  process finished exit code 1 

you using jre 1.7 spark version 2.6.0, need use java 8 can find below version of jre class file compatible this:

java se 9 = 53, java se 8 = 52, java se 7 = 51, java se 6.0 = 50, java se 5.0 = 49, 

for more can refer below stackoverflow link question : erjan , answer : many java experts.

how fix java.lang.unsupportedclassversionerror: unsupported major.minor version


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -