2

I am trying to run this example using option 3. I think I was able to build the project using activator but failed when I tried to run it using ./activator run command. When trying to run this the console spits out this cryptic message that I would not find much information about on Google. Here is the error:[warn] Error reading API from class file : java.lang.UnsupportedClassVersionError: akka/actor/UntypedActor : Unsupported major.minor version 52.0 java.lang.UnsupportedClassVersionError: akka/actor/UntypedActor : Unsupported major.minor version 52.0

What does this mean?

I am using Java 7 JDK on a Linux Ubuntu laptop.

Regards,

user3808269
  • 1,321
  • 3
  • 21
  • 40
  • Major minor version error comes when you compile with higher version(jdk 8 in your case) of jdk and run it on lower version of jdk (jdk 7 in this case) – Balwinder Singh Oct 05 '15 at 23:00
  • I wonder how I compiled with JDK 8 since it is not on my machine. I guess the examples come pre-compiled or the `activator` program compiles it with JDK 8. – user3808269 Oct 05 '15 at 23:19
  • Possible duplicate of [How to fix: Unsupported major.minor version 51.0 error?](http://stackoverflow.com/questions/10382929/how-to-fix-unsupported-major-minor-version-51-0-error) – Autar Oct 13 '15 at 13:26
  • This is a 52 point oh error though... but the post you are hyper-linking to is quite helpful. – user3808269 Oct 13 '15 at 14:33

2 Answers2

4

This example contains a pom.xml so you can see which version of Akka is used: http://www.typesafe.com/activator/template/akka-sample-main-java?_ga=1.217401040.754558484.1443808082#code/pom.xml

<dependency>
      <groupId>com.typesafe.akka</groupId>
      <artifactId>akka-actor_2.11</artifactId>
      <version>2.4.0</version>
    </dependency>

Akka 2.4.0 requires Java 8: http://akka.io/news/2015/09/30/akka-2.4.0-released.html

dropped support for Java 6 & 7 as announced in the last roadmap update, and now require Java 8 or later—this will allow us to create modern idiomatic Java APIs over the course of the upcoming releases

Therefore it is not just this example which will not work. Any akka code which uses akka 2.4.0 will fail with your jdk.

However, these examples are stored in github under the akka project so you could clone from there and checkout an older version, which should work with your machine:

https://github.com/akka/akka/tree/v2.3.14/akka-samples/akka-sample-main-java

mattinbits
  • 10,370
  • 1
  • 26
  • 35
2

Your class is compiled for Java 8 (that's what version 52 means). You need to recompile (or find a precompiled version) for Java 7.

Andy Turner
  • 137,514
  • 11
  • 162
  • 243