termux-packages icon indicating copy to clipboard operation
termux-packages copied to clipboard

[Package]: openjdk-21

Open AntonPieper opened this issue 2 years ago • 10 comments

Why is it worth to add this package?

OpenJDK-21 is now the latest LTS release. It makes sense to add the LTS versions to termux.

Home page URL

https://openjdk.org/projects/jdk/21/

Source code URL

https://github.com/openjdk/jdk21

Packaging policy acknowledgement

  • [X] I certify that I have read Termux Packaging Policy and understand that my request will be denied in case of violation.

Additional information

No response

AntonPieper avatar Sep 28 '23 07:09 AntonPieper

This might be helpful:

  • Patched source code: openjdk-21-android
  • https://github.com/itsaky/termux-packages/tree/master/packages/openjdk-21

itsaky avatar Oct 01 '23 09:10 itsaky

This might be helpful:

  • Patched source code: openjdk-21-android
  • https://github.com/itsaky/termux-packages/tree/master/packages/openjdk-21

can this build success?

oldcwj avatar Dec 01 '23 15:12 oldcwj

This might be helpful:

  • Patched source code: openjdk-21-android
  • https://github.com/itsaky/termux-packages/tree/master/packages/openjdk-21

can this build success?

With termux-packages' build system, yes. I didn't try to build a standalone version.

I built version 21.0.0 successfully. OpenJDK 21.0.1 has also been merged in openjdk-21-android after that. The patches should be compatible, but I haven't tested the build yet.

itsaky avatar Dec 01 '23 16:12 itsaky

This might be helpful:

  • Patched source code: openjdk-21-android
  • https://github.com/itsaky/termux-packages/tree/master/packages/openjdk-21

can this build success?

With termux-packages' build system, yes. I didn't try to build a standalone version.

I built version 21.0.0 successfully. OpenJDK 21.0.1 has also been merged in openjdk-21-android after that. The patches should be compatible, but I haven't tested the build yet.

root@vultr:~/termux-packages# ./scripts/run-docker.sh ./build-package.sh openjdk-21 Running container 'termux-package-builder' from image 'ghcr.io/termux/package-builder'... termux - building openjdk-21 for arch aarch64... ERROR: Package libfcft depends on non-existing package "libxkbcommon" ERROR: Obtaining buildorder failed

libxkbcommon already installed

@itsaky

oldcwj avatar Dec 02 '23 08:12 oldcwj

root@vultr:~/termux-packages# ./scripts/run-docker.sh ./build-package.sh openjdk-21 Running container 'termux-package-builder' from image 'ghcr.io/termux/package-builder'... termux - building openjdk-21 for arch aarch64... ERROR: Package libfcft depends on non-existing package "libxkbcommon" ERROR: Obtaining buildorder failed

I don't know what's causing this issue, but you can try to build openjdk-21 without the libfcft package ( openjdk-21 doesn't seem to be dependent on libfcft directly or indirectly).

Please note that the fork I have mentioned here has been patched to build the packages for AndroidIDE. So, if you build any package with that fork, the packages won't work in Termux (hardcoded package name).

In my opinion, if you plan to use OpenJDK 21 in Termux, you should:

  1. Clone termux/termux-packages.
  2. Copy openjdk-21 from itsaky/termux-packages to termux/termux-packages you cloned.
  3. Build openjdk-21 in termux/termux-packages.

Also, I made the following changes to the installation procedure for both openjdk-17 and openjdk-21 in my fork:

  • JDK is installed at $PREFIX/opt/openjdk-${version} instead of $PREFIX/opt/openjdk (version number is appended to the directory name).
  • The .deb file for the packages now contain postinst and prerm scripts which use update-alternatives to select the appropriate JDK installation. Termux currently creates a symlink to the binary files.

These changes might affect existing openjdk-17 installation.

itsaky avatar Dec 04 '23 15:12 itsaky

@oldcwj

I forgot to mention that you may face some issues with the linking process while building libidn2. However, you can execute build-package.sh with -I flag to download the pre-built libidn2 package from the package repository.

itsaky avatar Dec 04 '23 16:12 itsaky

@itsaky Thank you for your reply.

oldcwj avatar Dec 05 '23 01:12 oldcwj

Any update on this - I see jdk21 is still not available

ivivanov-bg avatar Mar 09 '24 17:03 ivivanov-bg

How about openjdk 22 while we're at it?

Icedude907 avatar Aug 18 '24 02:08 Icedude907

how do you guys pass the configure --with-boot-jdk? when im at the step of configure it will give me all of this log:

configure: Found potential Boot JDK using configure arguments
configure: Potential Boot JDK found at /data/data/com.termux/files/home/jdk-21 is not a working JDK; ignoring
configure: Output from java -version was: /data/data/com.termux/files/home/openjdk-21-android/build/.configure-support/generated-configure.sh: line 68184: /data/data/com.termux/files/home/jdk-21/bin/java: cannot execute: required file not found
configure: error: The path given by --with-boot-jdk does not contain a valid Boot JDK
configure exiting with result code 1

I have tried using jdk21, jdk21.0.1, and jdk22 but they are give me all the same result i dont know how to do right now

(edit) i found a paper to tell me open the proot-distro i finished this problem thanks

jarryzeng avatar Aug 18 '24 21:08 jarryzeng

This is helpful. Thanks. 👍

gphg avatar Sep 20 '24 17:09 gphg

I use OpenJdk-21-and-alot-of-debs.zip, unzip and dpkg -i openjdk-21_21.0.1_aarch64.deb. The jdk21 would installed at /data/data/com.termux/files/usr/opt/openjdk-21.0.1.
I try it , it just works fine.

./java --version openjdk 21.0.1-internal 2023-10-17 OpenJDK Runtime Environment (build 21.0.1-internal-adhoc.root.src) OpenJDK 64-Bit Server VM (build 21.0.1-internal-adhoc.root.src, mixed mode)

zph95 avatar Oct 15 '24 10:10 zph95

Fixed by 169241ab2834c6056ee15faae4c5efd1d794ef72.

twaik avatar Oct 17 '24 12:10 twaik

how do i run java after i run pkg install openjdk-21?

bulieme avatar May 31 '25 06:05 bulieme