Java – how do I run the play framework 2.1 project in IntelliJ?

I have an existing play 2.1 project I've been running it on the console and it works normally However, when I try to run it using IntelliJ, it doesn't work:

https://www.jetbrains.com/help/idea/getting-started-with-play-2-x.html#run_debug_playApp

First, I try to run the application by right clicking it and selecting run playback 2 application It won't run, it gave me this error:

sbt.IncompatiblePluginsException: Binary incompatibility in plugins detected.

After some research on this problem, I will - djline Terminal = add to my JVM options and try again This time it runs, but this error occurs when I try to open a page in the browser:

Global : Unsupported major.minor version 52.0

Finally, I tried to import my project back into IntelliJ Before it imports, it forces me to build The SBT version in properties is from 0.12 2 updated to 0.12 4. I did this, but still encountered the same error listed above

Note: I set Java 7 as my JDK

This is the complete stack trace:

play.api.PlayException: Cannot init the Global object[Global : Unsupported major.minor version 52.0]
    at play.api.WithDefaultGlobal$$anonfun$play$api$WithDefaultGlobal$$globalInstance$1.apply(Application.scala:57) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.api.WithDefaultGlobal$$anonfun$play$api$WithDefaultGlobal$$globalInstance$1.apply(Application.scala:51) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.utils.Threads$.withContextClassLoader(Threads.scala:18) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.api.WithDefaultGlobal$class.play$api$WithDefaultGlobal$$globalInstance(Application.scala:50) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.api.DefaultApplication.play$api$WithDefaultGlobal$$globalInstance$lzycompute(Application.scala:383) ~[play_2.10-2.1.1.jar:2.1.1]
    at play.api.DefaultApplication.play$api$WithDefaultGlobal$$globalInstance(Application.scala:383) ~[play_2.10-2.1.1.jar:2.1.1]
Caused by: java.lang.UnsupportedClassVersionError: Global : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_80]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[na:1.7.0_80]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.7.0_80]
    at java.net.urlclassloader.defineClass(urlclassloader.java:449) ~[na:1.7.0_80]
    at java.net.urlclassloader.access$100(urlclassloader.java:71) ~[na:1.7.0_80]
    at java.net.urlclassloader$1.run(urlclassloader.java:361) ~[na:1.7.0_80]

Solution

The problem is due to a java version mismatch Refer to Wikipedia Java class reference:

J2SE 8 = 52

J2SE 7 = 51

Error importing project try to change project SDK from Java 8 to Java 7

You can try adding the following to build sbt:

javacOptions = Seq(“ – source”,“1.7”,“ – target”,“1.7”)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>