运行 Grails 3.1 中的 JAR 抛出 UnsupportedClassVersionError

Running JAR in Grails 3.1 Throws UnsupportedClassVersionError

当我运行...

grails package
java -jar build/libs/<my_app>.jar

我明白了...

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/company/my_app/Application : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access0(URLClassLoader.java:71)
        at java.net.URLClassLoader.run(URLClassLoader.java:361)
        at java.net.URLClassLoader.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:47)
        at java.lang.Thread.run(Thread.java:745)

事实证明这很简单。我是 运行 Java 7。当我升级到 Java 8 时,一切正常。