在Grails 3.1中运行JAR引发UnsupportedClassVersionError

时间:2016-03-01 19:36:45

标签: grails java-8 java-7

当我跑...

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.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.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)

1 个答案:

答案 0 :(得分:0)

结果很简单。我使用的是Java 7.当我升级到Java 8时,一切正常。