Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported major.minor version 51.0 while running play framework

I know there is version conflict. Just want someone to tell me how to resolve it. In previous stackoverflow post no one tells the solution.

Versions: Ubuntu: 12.04.1 LTS java: 1.6.0_24 (OpenJDK) javac: 1.7.0_07 (OpenJDK)

haider@haider-desktop:~/Documents/projects/java-projects/mytestapp$ play [info] Loading project definition from /home/haider/Documents/projects/java-projects/mytestapp/project [info] Set current project to mytestapp (in build file:/home/haider/Documents/projects/java-projects/mytestapp/)        _            _   _ __ | | __ _ _  _| | | '_ \| |/ _' | || |_| |  __/|_|\____|\__ (_) |_|            |__/   play! 2.0.4, http://www.playframework.org  > Type "help play" or "license" for more information. > Type "exit" or use Ctrl+D to leave this console.  [mytestapp] $ run  --- (Running the application from SBT, auto-reloading is enabled) --- [info] play - Listening for HTTP on port 9000...  (Server started, use Ctrl+D to stop and go back to the console...)  [info] Compiling 5 Scala sources and 2 Java sources to /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/target/scala-2.9.1/classes... [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/target/scala-2.9.1/src_managed/main/controllers/routes.java : java.lang.UnsupportedClassVersionError: controllers/routes : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/target/scala-2.9.1/src_managed/main/controllers/routes.java : java.lang.UnsupportedClassVersionError: controllers/routes$javascript : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/target/scala-2.9.1/src_managed/main/controllers/routes.java : java.lang.UnsupportedClassVersionError: controllers/routes : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/target/scala-2.9.1/src_managed/main/controllers/routes.java : java.lang.UnsupportedClassVersionError: controllers/routes$ref : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/target/scala-2.9.1/src_managed/main/controllers/routes.java : java.lang.UnsupportedClassVersionError: controllers/routes$javascript : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/target/scala-2.9.1/src_managed/main/controllers/routes.java : java.lang.UnsupportedClassVersionError: controllers/routes : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/target/scala-2.9.1/src_managed/main/controllers/routes.java : java.lang.UnsupportedClassVersionError: controllers/routes$ref : Unsupported major.minor version 51.0 [warn] Error reading API from class file : java.lang.UnsupportedClassVersionError: controllers/routes$javascript : Unsupported major.minor version 51.0 [warn] Error reading API from class file : java.lang.UnsupportedClassVersionError: controllers/routes : Unsupported major.minor version 51.0 [warn] Error reading API from class file : java.lang.UnsupportedClassVersionError: controllers/routes$ref : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/app/controllers/Application.java : java.lang.UnsupportedClassVersionError: controllers/Application$Hello : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/app/controllers/Application.java : java.lang.UnsupportedClassVersionError: controllers/Application : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/app/controllers/Application.java : java.lang.UnsupportedClassVersionError: controllers/Application$Hello : Unsupported major.minor version 51.0 [warn] Problem processing dependencies of source /home/haider/Documents/projects/libraries/play-2.0.4/samples/java/helloworld/app/controllers/Application.java : java.lang.UnsupportedClassVersionError: controllers/Application : Unsupported major.minor version 51.0 [warn] Error reading API from class file : java.lang.UnsupportedClassVersionError: controllers/Application$Hello : Unsupported major.minor version 51.0 [warn] Error reading API from class file : java.lang.UnsupportedClassVersionError: controllers/Application : Unsupported major.minor version 51.0 [info] play - Application started (Dev) 
like image 980
Haider Avatar asked Oct 04 '12 07:10

Haider


1 Answers

You are using different JDK versions to compile and run the application. You say that:

java: 1.6.0_24 (OpenJDK)  javac: 1.7.0_07 (OpenJDK) 

So your compiler (javac) is a newer release than the java command, which means the second can't run your compiled files. You must use only 1 version of the JDK (same for java and javac)

like image 192
Pere Villega Avatar answered Oct 02 '22 19:10

Pere Villega