如何在安装kafka时解决"转换过程中的一般错误:不支持的类文件主版本61"



我正试图按照kafka官方网站的安装页面安装kafka,但我遇到了这个错误:

❯ cd kafka-3.0.0-src
❯ bin/zookeeper-server-start.sh config/zookeeper.properties
Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=2.13.6'
❯ ./gradlew jar -PscalaVersion=2.13.6
Downloading https://services.gradle.org/distributions/gradle-7.1.1-all.zip
..............10%...............20%...............30%...............40%..............50%...............60%...............70%...............80%..............90%...............100%
Welcome to Gradle 7.1.1!
Here are the highlights of this release:
- Faster incremental Java compilation
- Easier source set configuration in the Kotlin DSL
For more details see https://docs.gradle.org/7.1.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/user/Downloads/kafka-3.0.0-src/settings.gradle'
* What went wrong:
Could not compile settings file '/Users/user/Downloads/kafka-3.0.0-src/settings.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 61
java.lang.IllegalArgumentException: Unsupported class file major version 61
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:189)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:170)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:156)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:277)
at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:251)
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:189)

...
1 error

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 31s

我怀疑这是因为我的渐变版本,但我不知道如何解决它。

我使用的是java17运行时:

❯ pwd
/Users/user
❯ java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)

操作系统是MacOS 11.6.2

您不需要Gradle来安装或运行Kafka。

你链接到的页面上写着下载一个发布的tarball,而不是来源。您也可以在Mac上使用brew install kafka(和Zookeeper(,并使用brew services start来运行两者。

或者你可以使用Docker

相关内容

  • 没有找到相关文章

最新更新