=== modified file 'base_ubuntu/repo/switch-java.sh'
--- old/base_ubuntu/repo/switch-java.sh	2025-02-25 18:03:09 +0000
+++ new/base_ubuntu/repo/switch-java.sh	2025-06-20 09:14:14 +0000
@@ -1,6 +1,13 @@
 #!/bin/bash
 
-if [ "$JDK_VERSION" == "17" ]; then
+if [ "$JDK_VERSION" == "21" ]; then
+   update-alternatives --quiet --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java
+   update-alternatives --quiet --set javac /usr/lib/jvm/java-21-openjdk-amd64/bin/javac
+   # configure JNI linking - https://proj.goldencode.com/projects/p2j/wiki/Configure_JNI_Linking	
+   [ -L "/usr/lib/libjvm.so" ] && rm /usr/lib/libjvm.so
+   ln -s /usr/lib/jvm/java-21-openjdk-amd64/lib/server/libjvm.so /usr/lib/libjvm.so
+   echo "Setup JDK 21" > /tmp/switch-java.log
+elif [ "$JDK_VERSION" == "17" ]; then
    update-alternatives --quiet --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java
    update-alternatives --quiet --set javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac
    # configure JNI linking - https://proj.goldencode.com/projects/p2j/wiki/Configure_JNI_Linking	

=== modified file 'base_ubuntu_22.04_Dockerfile'
--- old/base_ubuntu_22.04_Dockerfile	2025-06-18 22:09:06 +0000
+++ new/base_ubuntu_22.04_Dockerfile	2025-06-20 09:12:23 +0000
@@ -50,7 +50,7 @@
 #                  contain 1000:1000 already so we need to update, not create.
 #     RFB 20250610 The timezone handling needed to be updated to the 24.04 method.
 #     RFB 20250618 Some further refinements to make sure we are utilizing the correct version.
-
+#     TJD 20250620 Support for Java 21
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as
 # published by the Free Software Foundation, either version 3 of the
@@ -117,7 +117,7 @@
 ARG TZDATA_AREA=America
 ARG TZDATA_ZONE=New_York
 ARG BASE_OS_TOOLS="build-essential apt-utils wget curl dos2unix gcc jq locales sudo unzip vim zip bzr python3-paramiko openssh-server openssh-client gosu iproute2 iputils-ping dnsutils iproute2 rsync less p7zip-full screen"
-ARG JDK_INSTALL="openjdk-8-jdk openjdk-8-source openjdk-17-jdk openjdk-17-source"
+ARG JDK_INSTALL="openjdk-8-jdk openjdk-8-source openjdk-17-jdk openjdk-17-source openjdk-21-jdk openjdk-21-source"
 ARG RUNTIME_TOOLS="dpkg-dev libffi-dev libncurses5-dev ncurses-term ant libpam0g-dev"
 ARG FWD_UID=1000
 ARG FWD_GID=1000
@@ -230,7 +230,9 @@
 RUN update-alternatives --install /usr/bin/java  java  /usr/lib/jvm/java-8-openjdk-amd64/bin/java   1081 && \
     update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac  1081 && \
     update-alternatives --install /usr/bin/java  java  /usr/lib/jvm/java-17-openjdk-amd64/bin/java  1082 && \
-    update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac 1082
+    update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac 1082 && \
+    update-alternatives --install /usr/bin/java  java  /usr/lib/jvm/java-21-openjdk-amd64/bin/java  1083 && \
+    update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-21-openjdk-amd64/bin/javac 1083
 
 # Step 14/33
 COPY java_admin /etc/sudoers.d/

=== modified file 'build_base_ubuntu.sh'
--- old/build_base_ubuntu.sh	2025-06-10 08:51:04 +0000
+++ new/build_base_ubuntu.sh	2025-06-20 11:30:03 +0000
@@ -80,7 +80,7 @@
 tzdata_area_value_def="America"
 tzdata_zone_value_def="New_York"
 base_os_tools_def="build-essential apt-utils wget curl dos2unix gcc jq locales sudo unzip vim zip bzr python3-paramiko openssh-server openssh-client gosu iproute2 iputils-ping dnsutils iproute2 rsync less p7zip-full screen"
-jdk_install_def="openjdk-8-jdk openjdk-8-source openjdk-17-jdk openjdk-17-source"
+jdk_install_def="openjdk-8-jdk openjdk-8-source openjdk-17-jdk openjdk-17-source openjdk-21-jdk openjdk-21-source"
 runtime_tools_def="dpkg-dev libffi-dev libncurses5-dev ncurses-term ant libpam0g-dev"
 fwd_uid_def=1000
 fwd_gid_def=1000
@@ -189,6 +189,12 @@
    echo "Performing: $cmd"
    eval $cmd
 
+   # Repeat, but set default JDK to 21
+   cmd="docker build $progress_plain $no_cache -t ${image_name}_jdk21:${image_tag} -f ${dockerfile} --build-arg JDK_VERSION=21  ${jdk_build_args} ${contextdir}"
+   [ "$dry_run" = true ] && cmd="echo $cmd"
+   echo "Performing: $cmd"
+   eval $cmd
+
    # Previous base Ubuntu images will be used to create PG14 versions via a template Dockerfile
    update_dockerfile $pg_dockerfile ""
    cmd="docker build $progress_plain $no_cache -t ${pg_image_name}:${image_tag} -f ${pg_dockerfile} ${build_args} ${contextdir}"
@@ -202,6 +208,12 @@
    echo "Performing: $cmd"
    eval $cmd
 
+   update_dockerfile $pg_dockerfile "_jdk21"
+   cmd="docker build $progress_plain $no_cache -t ${pg_image_name}_jdk21:${image_tag} -f ${pg_dockerfile} ${build_args} ${contextdir}"
+   [ "$dry_run" = true ] && cmd="echo $cmd"
+   echo "Performing: $cmd"
+   eval $cmd
+
    # For the postgres and mariadb images, we use the context subdirectory we care about, to minimize the size
    cmd="docker build $progress_plain $no_cache -t ${postgres_image_name}:${image_tag} -f ${postgres_dockerfile} ${build_args} ${contextdir}"
    [ "$dry_run" = true ] && cmd="echo $cmd"

