OpenJDK 18 已安装,但 BuildTools 认为它​​是 Java 11?

OpenJDK 18 已安装,但 BuildTools 认为它​​是 Java 11?

我尝试在 Fedora 35 上运行 Minecraft Spigot BuildTools.jar,但它说我只安装了 Java 11。运行时环境版本是 18。我在这里做错了什么,或者这是一个错误?

[banana@fedora BuildTools]$ java -version
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment 18.9 (build 11.0.14.1+1)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.14.1+1, mixed mode, sharing)

[banana@fedora BuildTools]$ java -jar BuildTools.jar
Loading BuildTools version: git-BuildTools-1fbeb7f-147 (#147)
Java Version: Java 11
Current Path: /home/banana/Downloads/BuildTools/.
git version 2.35.1
BuildTools
[email protected]
Picked up _JAVA_OPTIONS: -Djdk.net.URLClassPath.disableClassPathURLCheck=true
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment 18.9 (build 11.0.14.1+1)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.14.1+1, mixed mode, sharing)
Attempting to build version: 'latest' use --rev <version> to override
Found version
{
    "name": "3479",
    "description": "Jenkins build 3479",
    "refs": {
        "BuildData": "641cb0c939c7c2a3c4b42f2fd7bca7c8b34254ae",
        "Bukkit": "fc460d1bb8d5f2bc9ff07dad1b7b402eed06d7c4",
        "CraftBukkit": "911bde181f16127a3904455509d318447a0f5198",
        "Spigot": "42b61526f13ff472e32714d8e7b75fce31cf1151"
    },
    "toolsVersion": 138,
    "javaVersions": [61, 62]
}

*** The version you have requested to build requires Java versions between [Java 17, Java 18], but you are using Java 11
*** Please rerun BuildTools using an appropriate Java version. For obvious reasons outdated MC versions do not support Java versions that did not exist at their release.

答案1

您需要配置您的 $PATH 以包含 jdk18 位置。

在您的 .bashrc 中,添加以下行:

export $PATH=$PATH;/opt/jdk-18/bin/

注销然后重新登录以重新加载您的 $PATH。

以下是完整的安装过程,因此一切顺利。只需确保删除系统上任何冲突的 Java 版本即可。-https://linuxman.co/linux-desktop/install-java-17-in-ubuntu-debian-and-fedora/

相关内容