当前位置: 首页 > 知识库问答 >
问题:

不支持的Major.Minor版本52.0-grails

乐正迪
2023-03-14

我刚刚从SVN下载了一个grails项目。

我看到不受支持的Major.Minor版本是S.O.上的一个众所周知的问题。由于运行时和编译时使用的JDK版本不匹配而导致。

但我使用的是与下面相同的版本:

外壳:

JAVA构建路径:

请告诉我,我错过了什么,仍然有下面的错误?

Environment set to development
  [groovyc] Compiling 190 source files to C:\Users\xxx
java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 52.0
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
    at _GrailsCompile_groovy$_run_closure4_closure10.doCall(_GrailsCompile_groovy:117)
    at _GrailsCompile_groovy$_run_closure4_closure10.doCall(_GrailsCompile_groovy)
    at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
    at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
    at _GrailsCompile_groovy$_run_closure4.doCall(_GrailsCompile_groovy:104)
    at _GrailsCompile_groovy$_run_closure3.doCall(_GrailsCompile_groovy:69)
    at _GrailsPackage_groovy$_run_closure2_closure9.doCall(_GrailsPackage_groovy:85)
    at _GrailsPackage_groovy$_run_closure2_closure9.doCall(_GrailsPackage_groovy)
    at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
    at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
    at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:84)
    at RunApp$_run_closure1.doCall(RunApp:28)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : 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 java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at org.codehaus.groovy.tools.javac.JavacJavaCompiler.findJavac(JavacJavaCompiler.java:160)
    at org.codehaus.groovy.tools.javac.JavacJavaCompiler.compile(JavacJavaCompiler.java:49)
    at org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.gotoPhase(JavaAwareCompilationUnit.java:94)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:484)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:453)
    at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:67)
    at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:180)
    at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:905)
    at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:607)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    ... 23 more
--- Nested Exception ---
java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : 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 java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at org.codehaus.groovy.tools.javac.JavacJavaCompiler.findJavac(JavacJavaCompiler.java:160)
    at org.codehaus.groovy.tools.javac.JavacJavaCompiler.compile(JavacJavaCompiler.java:49)
    at org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit.gotoPhase(JavaAwareCompilationUnit.java:94)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:484)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:453)
    at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:67)
    at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:180)
    at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:905)
    at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:607)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at _GrailsCompile_groovy$_run_closure4_closure10.doCall(_GrailsCompile_groovy:117)
    at _GrailsCompile_groovy$_run_closure4_closure10.doCall(_GrailsCompile_groovy)
    at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
    at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
    at _GrailsCompile_groovy$_run_closure4.doCall(_GrailsCompile_groovy:104)
    at _GrailsCompile_groovy$_run_closure3.doCall(_GrailsCompile_groovy:69)
    at _GrailsPackage_groovy$_run_closure2_closure9.doCall(_GrailsPackage_groovy:85)
    at _GrailsPackage_groovy$_run_closure2_closure9.doCall(_GrailsPackage_groovy)
    at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
    at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
    at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:84)
    at RunApp$_run_closure1.doCall(RunApp:28)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at gant.Gant.executeTargets(Gant.groovy:589)
Compilation error: java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 52.0

我通过右键单击Project->Run-as->grailsCommand(run-app)来运行它

共有1个答案

贝礼骞
2023-03-14

该项目是使用较新版本的JDK编译的,但运行的是较旧版本。清除所有代码并重新生成项目。

有时这是由于一个插件的二进制文件是用更高版本的Java编译的。

 类似资料:
  • 错误:(1,0)原因:com/android/build/gradle/libraryplugin:不受支持的Major.minor版本52.0 存档中 MyPath\AndroidStudioProjects\MyApp\App\libs\ColorPickerPreference\ColorPickerPreference\build.grad 和java版本 java版本“1.7.0_79”

  • 我试图按照Kafka网站https://kafka.apache.org/quickstart上的指南操作,但当我使用kafka2.12-2.5.0并尝试启动zookeeper时,我得到了: 我用的是Redhat7.1。尝试更新Java: 我应该有什么版本的Java?

  • 问题内容: Hello Hello.html Error 可能是什么问题? 问题答案: 问题是由于Java版本不匹配。参考类参考: Java SE 12 = 56(十六进制0x38) Java SE 11 = 55(十六进制0x37) Java SE 10 = 54 Java SE 9 = 53 Java SE 8 = 52 Java SE 7 = 51 Java SE 6.0 = 50 Java

  • 以前的解决方案建议: 升级Java运行时或 如果有源代码,请使用本地Java编译器(如果有)重新编译该类。 @Brad Parks-https://stackoverflow.com/users/26510/Brad-Parks 由于无法重新编译产生错误的文件,我尝试将我的JRE从JSK1.6升级到JDK1.8-这现在产生了错误: 我对Java还很陌生,所以我可能忽略/误解了一些东西

  • 我使用的是,当我使用以下命令检查Java版本时: