julienrf / play-jsmessages

Library to compute localized messages of your Play application on client side

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.2: Compiler error and runtime error

joscha opened this issue · comments

Hi,

I upgraded from 1.1 to 1.2 and get the following message while compilation:

[warn] warning: jsmessages/JsMessages.class(jsmessages:JsMessages.class): major version 51 is newer than 50, the highest major version supported by this compiler.
[warn] It is recommended that the compiler be upgraded.
[warn] 1 warning
[warn] Problem processing dependencies of source /Users/joscha/bla/app/controllers/Application.java : java.lang.UnsupportedClassVersionError: jsmessages/JsMessages : Unsupported major.minor version 51.0

and then at runtime:

play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[UnsupportedClassVersionError: jsmessages/JsMessages : Unsupported major.minor version 51.0]]
    at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.1-SNAPSHOT]
    at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.1-SNAPSHOT]
    at akka.actor.Actor$class.apply(Actor.scala:311) [akka-actor-2.0.1.jar:2.0.1]
    at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.1-SNAPSHOT]
    at akka.actor.ActorCell.invoke(ActorCell.scala:619) [akka-actor-2.0.1.jar:2.0.1]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:196) [akka-actor-2.0.1.jar:2.0.1]
Caused by: java.lang.UnsupportedClassVersionError: jsmessages/JsMessages : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.6.0_31]
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) ~[na:1.6.0_31]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615) ~[na:1.6.0_31]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) ~[na:1.6.0_31]
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) ~[na:1.6.0_31]
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58) ~[na:1.6.0_31]

Was 1.2 compiled with Java 7 by any chance?

Indeed I’m compiling with JDK 1.7.
When I try to use -source 1.6 -target 1.6 options I get the following warning:

[warn] warning: [options] bootstrap class path not set in conjunction with -source 1.6

I have no idea where it could come from…

From http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/javac.html:

You must specify the -bootclasspath option to specify the correct version of the bootstrap classes (the rt.jar library). If not, the >compiler generates a warning:

% javac -source 1.6 OldCode.java
warning: [options] bootstrap class path not set in conjunction with -source 1.6

If you do not specify the correct version of bootstrap classes, the compiler will use the old language rules (in this example, it >will use version 1.6 of the Java programming language) combined with the new bootstrap classes, which can result in class >files that do not work on the older platform (in this case, Java SE 6) because reference to non-existent methods can get >included.

The right way to do it is also on that page and seems to be like this:

% javac -source 1.6 -target 1.6 -bootclasspath jdk1.6.0/lib/rt.jar
-extdirs "" OldCode.java

Any luck on this, because if I understand it correctly, using Java 1.7 with Play 2.x and 2.1-SNAPSHOT is still discouraged, so that basically means people would need to use play-jsmessages 1.1 until 1.7 is officially cleared for play 2.x, right?

Ok, I’ll try to get 1.6 compatibility.

Can you tell me if it’s ok with 1.2.1?

like a charm :-) Thank you!