termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.33k stars 3.06k forks source link

[Bug]: openjdk-17 is not recognized as general Java version? #16978

Closed gphg closed 1 year ago

gphg commented 1 year ago

Problem description

I upgraded current Minecraft Server (PaperMC) to 1.20.1, run the jar and got this error.

Unsupported Java detected (17-internal). You are running an outdated, pre-release version. Only general availability versions of Java are supported. Please update your Java version.

But it works if I downgrade to previous version.

The other solution that upgrading is to get it running under Termux's proot-distro.

More info on which Java Version: https://docs.papermc.io/paper/getting-started

What steps will reproduce the bug?

  1. Get openjdk-17 installed (Termux has no other version than this).
  2. Get PaperMC JAR (Java ARchive): https://papermc.io/downloads/paper
  3. Run it, eg java -Xms2G -Xmx2G -jar paper.jar --nogui

What is the expected behavior?

A Minecraft Server run normally.

System information

termux-info:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=13657
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.bardia.tech/termux/termux-main stable main
# x11-repo (sources.list.d/x11.list)
deb https://mirror.bardia.tech/termux/termux-x11 x11 main
# sources.list.d/rendiix.list
deb https://rendiix.github.io android-tools termux
Updatable packages:
All packages up to date
termux-tools version:
1.38.3
Android version:
10
Kernel build information:
Linux localhost 4.9.190 #1 SMP PREEMPT Wed Oct 14 15:47:23 CST 2020 aarch64 Android
Device manufacturer:
ELEVATE
Device model:
LUNA G5
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
com.termux.x11 versionCode:10
com.termux.boot versionCode:7
xtkoba commented 1 year ago

Just that the version checker of that app is bogus. Not our issue.

gphg commented 1 year ago

Just that the version checker of that app is bogus. Not our issue.

You are right.

It was caused by this single change: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/863dacb7a00f2d5d641a93951885620cbb7eb36d

String javaVersionName = System.getProperty("java.version");
// J2SE SDK/JRE Version String Naming Convention
boolean isPreRelease = javaVersionName.contains("-");
if (isPreRelease && javaVersion == 61.0) {
        System.err.println("Unsupported Java detected (" + javaVersionName + "). You are running an outdated, pre-release version. Only general availability versions of Java are supported. Please update your Java version.");
        return;
}

I wish there is away to change internal string of java.version.

gphg commented 1 year ago

Similar issue #18334. Paper's based code is Spigot.