OpenJDK Download
Download the source file.
# mkdir -p /tmp/OpenJDK
# cd /tmp/OpenJDK
# wget https://github.com/openjdk/jdk23u/archive/refs/tags/jdk-23.0.1-ga.tar.gz
Expand
# tar xvf jdk-23.0.1-ga.tar.gz
# cd jdk23u-jdk-23.0.1-ga
Boot JDK
To build a JDK, you need an existing JDK, which is called a “boot JDK.”
The boot JDK used to build a major JDK version (JDKxx) must be JDKxx-1.
If you are building JDK 23, JDK 22 is suitable as the boot JDK.
Download the OpenJDK 22 binaries for Linux.
# wget https://download.java.net/java/GA/jdk22.0.2/c9ecb94cd31b495da20a27d4581645e8/9/GPL/openjdk-22.0.2_linux-x64_bin.tar.gz
Extract this to use it as the boot JDK.
# mkdir -p boot-jdk
# tar xvf openjdk-22.0.2_linux-x64_bin.tar.gz -C boot-jdk
Navigate to the source code directory.
# cd jdk23u-jdk-23.0.1-ga
configure
# ./configure \
--prefix=/usr \
--with-extra-cflags="-O2" \
--with-extra-cxxflags="-O2" \
--with-harfbuzz=bundled \
--with-zlib=bundled \
--with-giflib=system \
--with-lcms=system \
--with-libjpeg=system \
--with-libpng=system \
--enable-unlimited-crypto \
--with-boot-jdk=./boot-jdk/jdk-22.0.2
Then, the following output will appear, and configure will complete successfully.
A new configuration has been successfully created in
/home/takehora/Downloads/openjdk/jdk23u-jdk-23.0.1-ga/build/linux-x86_64-server-release
using configure arguments '--prefix=/usr --with-extra-cflags=-O2 --with-extra-cxxflags=-O2 --with-harfbuzz=bundled --with-zlib=bundled --with-giflib=system --with-lcms=system --with-libjpeg=system --with-libpng=system --enable-unlimited-crypto --with-boot-jdk=../boot-jdk/jdk-22.0.2'.
Configuration summary:
* Name: linux-x86_64-server-release
* Debug level: release
* HS debug level: product
* JVM variants: server
* JVM features: server: 'cds compiler1 compiler2 epsilongc g1gc jfr jni-check jvmci jvmti management parallelgc serialgc services shenandoahgc vm-structs zgc'
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
* Version string: 23.0.1-internal-adhoc.takehora.jdk23u-jdk-23.0.1-ga (23.0.1-internal)
* Source date: 1731405204 (2024-11-12T09:53:24Z)
Tools summary:
* Boot JDK: openjdk version "22.0.2" 2024-07-16 OpenJDK Runtime Environment (build 22.0.2+9-70) OpenJDK 64-Bit Server VM (build 22.0.2+9-70, mixed mode, sharing) (at /home/takehora/Downloads/openjdk/boot-jdk/jdk-22.0.2)
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 14.2.0 (at /usr/bin/gcc)
* C++ Compiler: Version 14.2.0 (at /usr/bin/g++)
Build performance summary:
* Build jobs: 12
* Memory limit: 64142 MB
Build
# make images
Package Creation
Since there is no make install command, manually copy the files to the directory used for package creation.
# mkdir -p /tmp/openjdk-23.0.1-ga/usr/lib64/java/
# cp -a build/linux*/images/jdk/* /tmp/openjdk-23.0.1-ga/usr/lib64/java/
I don't need the demo-related files, so I'll delete them.
# rm -rf /tmp/openjdk-23.0.1-ga/usr/lib64/java/demo
Place the configuration file in /etc and create a symbolic link.
# mkdir -p /tmp/openjdk-23.0.1-ga/etc
# mv /tmp/openjdk-23.0.1-ga/usr/lib64/java/conf /tmp/openjdk-23.0.1-ga/etc/openjdk
# ln -s /etc/openjdk /tmp/openjdk-23.0.1-ga/usr/lib64/java/conf
Move the various configuration files to the /etc directory in the package build directory.
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/logging.properties{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/net.properties{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/sound.properties{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/management/jmxremote.access{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/management/jmxremote.password.template{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/management/management.properties{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/security/policy/unlimited/default_local.policy{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/security/policy/unlimited/default_US_export.policy{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/security/policy/limited/default_local.policy{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/security/policy/limited/default_US_export.policy{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/security/policy/limited/exempt_local.policy{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/security/java.security{,.new}
# mv /tmp/openjdk-23.0.1-ga/etc/openjdk/security/java.policy{,.new}
# find /tmp/openjdk-23.0.1-ga -name "*.so" -exec strip --strip-debug {} \;
Generate the cacerts file from the ca-certificates package installed on Slackware.
The cacerts file in the OpenJDK source may be out of date.
This requires the trust program from p11-kit.
# rm -f /tmp/openjdk-23.0.1-ga/usr/lib64/java/lib/security/cacerts
# trust extract --format=java-cacerts --filter=ca-anchors --purpose=server-auth /tmp/openjdk-23.0.1-ga/usr/lib64/java/lib/security/cacerts
I'll create a symbolic link so that the command "java" will work.
# ln -sf java /tmp/openjdk-23.0.1-ga/usr/lib64/java/
Add a profile script. Create openjdk.sh and openjdk.csh.
# mkdir -p /tmp/openjdk-23.0.1-ga/etc/profile.d
# cat <<EOF > /tmp/openjdk-23.0.1-ga/etc/profile.d/openjdk.sh
export JAVA_HOME=/usr/lib64/java
export PATH=\$PATH:\$JAVA_HOME/bin
EOF
# cat <<EOF > /tmp/openjdk-23.0.1-ga/etc/profile.d/openjdk.csh
setenv JAVA_HOME /usr/lib64/java
setenv PATH \${PATH}:\${JAVA_HOME}/bin
EOF
Grant execution permissions to the script you created.
# chmod 755 /tmp/openjdk-23.0.1-ga/etc/profile.d/openjdk.sh
# chmod 755 /tmp/openjdk-23.0.1-ga/etc/profile.d/openjdk.csh
Add menu entries and icons to the package.
Create a directory
# mkdir -p /tmp/openjdk-23.0.1-ga/usr/share/icons/hicolor/16x16/apps/
# mkdir -p /tmp/openjdk-23.0.1-ga/usr/share/icons/hicolor/24x24/apps/
# mkdir -p /tmp/openjdk-23.0.1-ga/usr/share/icons/hicolor/32x32/apps/
# mkdir -p /tmp/openjdk-23.0.1-ga/usr/share/icons/hicolor/48x48/apps/
Copy the various sizes of the desktop icons to the package creation directory.
# cp src/java.desktop/unix/classes/sun/awt/X11/java-icon16.png /tmp/openjdk-23.0.1-ga/usr/share/icons/hicolor/16x16/apps/openjdk23.png
# cp src/java.desktop/unix/classes/sun/awt/X11/java-icon24.png /tmp/openjdk-23.0.1-ga/usr/share/icons/hicolor/24x24/apps/openjdk23.png
# cp src/java.desktop/unix/classes/sun/awt/X11/java-icon32.png /tmp/openjdk-23.0.1-ga/usr/share/icons/hicolor/32x32/apps/openjdk23.png
# cp src/java.desktop/unix/classes/sun/awt/X11/java-icon48.png /tmp/openjdk-23.0.1-ga/usr/share/icons/hicolor/48x48/apps/openjdk23.png
Add a desktop file.
Create a directory
# mkdir -p /tmp/openjdk-23.0.1-ga/usr/share/applications
Create a desktop file.
# vi /tmp/openjdk-23.0.1-ga/usr/share/applications/openjdk23-java.desktop
Describe the following
[Desktop Entry]
Version=1.0
Name=OpenJDK Java
Comment=Run Java applications
Exec=/usr/lib64/java/bin/java %U
Terminal=false
Type=Application
Icon=openjdk23
Categories=Development;IDE;
MimeType=application/x-java-archive;application/java-archive;application/x-jar;
Move the man pages to the package build directory and create a symbolic link to that directory.
openjdk22-23.0.1 does not include the Japanese ja_man pages.
# mv /tmp/openjdk-23.0.1-ga/usr/lib64/java/man /tmp/openjdk-23.0.1-ga/usr
# ln -s /usr/man /tmp/openjdk-23.0.1-ga/usr/lib64/java/
Package Creation
# cd /tmp/openjdk-23.0.1-ga
# makepkg --linkadd y --chown y ../openjdk-23.0.1-ga-x86_64-1.txz
------------------
Slackware package ../openjdk-23.0.1-ga-x86_64-1.txz created.
Change the permissions for this package to 755, then install the package.
# cd ..
# chmod 755 openjdk-23.0.1-ga-x86_64-1.txz
# installpkg openjdk-23.0.1-ga-x86_64-1.txz
Immediately after installation, the java command will not be in your PATH, so please run /etc/profile.d/openjdk.sh.
Alternatively, if you restart the system, that file will be loaded automatically, and the java command will be added to your PATH.
