├── .gitignore ├── README.md ├── extract_cacerts.sh ├── flathub.json ├── org.freedesktop.Sdk.Extension.openjdk.appdata.xml └── org.freedesktop.Sdk.Extension.openjdk.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | .flatpak-builder 2 | repo 3 | builddir 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SDK Extension for OpenJDK 23 2 | 3 | This extension contains the OpenJDK 23 Java Runtime Environment (JRE) and Java Developement Kit (JDK). 4 | 5 | OpenJDK 23 is the current latest version. This is *not* a long-term support (LTS) version and will be periodically updated as new JDKs are released. 6 | 7 | For the current LTS version, see the [OpenJDK 21](https://github.com/flathub/org.freedesktop.Sdk.Extension.openjdk21) extension. 8 | 9 | For the previous LTS version, see the [OpenJDK 17](https://github.com/flathub/org.freedesktop.Sdk.Extension.openjdk17) extension. 10 | 11 | ## Usage 12 | 13 | You can bundle the JRE with your Flatpak application by adding it to `sdk-extensions` in your Flatpak manifest and executing the `/usr/lib/sdk/openjdk/install.sh` script. 14 | 15 | Simplified example to make the JRE available at runtime: 16 | 17 | ```yaml 18 | id: org.example.MyApp 19 | runtime: org.freedesktop.Platform 20 | runtime-version: '24.08' 21 | sdk: org.freedesktop.Sdk 22 | sdk-extensions: 23 | - org.freedesktop.Sdk.Extension.openjdk 24 | 25 | modules: 26 | - name: openjdk 27 | buildsystem: simple 28 | build-commands: 29 | - /usr/lib/sdk/openjdk/install.sh 30 | - name: myapp 31 | buildsystem: simple 32 | ... 33 | 34 | ... 35 | 36 | finish-args: 37 | - --env=PATH=/app/jre/bin:/app/bin:/usr/bin 38 | ``` 39 | 40 | To additionally make the JRE available at buildtime of module `myapp`, set `build-options.append-path` accordingly: 41 | 42 | ```yaml 43 | ... 44 | 45 | modules: 46 | ... 47 | - name: myapp 48 | buildsystem: simple 49 | build-options: 50 | append-path: /usr/lib/sdk/openjdk/jvm/openjdk-23/bin 51 | ... 52 | ``` 53 | 54 | ## Development 55 | 56 | ### Build and install 57 | 58 | ```bash 59 | flatpak-builder --user --install --force-clean flatpakbuildir org.freedesktop.Sdk.Extension.openjdk.yaml 60 | ``` 61 | ### Uninstall 62 | 63 | ```bash 64 | flatpak uninstall --user org.freedesktop.Sdk.Extension.openjdk 65 | -------------------------------------------------------------------------------- /extract_cacerts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Tool to generate a Java-style "cacerts" keystore from the installed 4 | # system certificates 5 | 6 | set -e 7 | 8 | jdk=${1:-/app/jdk} 9 | 10 | function get_alias() { 11 | local alias="" 12 | local issuer="${1// /}," 13 | # Determine which attribute to use for the alias 14 | if [[ $issuer =~ CN= ]] ; then 15 | # Use the "Common Name" if available 16 | alias=$(echo "$issuer" | sed -e 's/.*CN=\([^,]*\),.*/\1/') 17 | # Unless it's GlobalSign, because of non-uniqueness 18 | if [[ $alias == GlobalSign ]] ; then 19 | # In which case use the "Organisational Unit" instead 20 | alias=$(echo "$issuer" | sed -e 's/.*OU=\([^,]*\),.*/\1/') 21 | fi 22 | elif [[ $issuer =~ OU= ]] ; then 23 | # Use the "Organisational Unit" if CN is unavailable 24 | alias=$(echo "$issuer" | sed -e 's/.*OU=\([^,]*\),.*/\1/') 25 | else 26 | # Use the "Organisation" if CN and OU are unavailable 27 | alias=$(echo "$issuer" | sed -e 's/.*O=\([^,]*\),.*/\1/') 28 | fi 29 | # Return only acsii chars, all lowercase, all one word, just to be consistent with what p11-kit would do 30 | echo "$alias" | tr '[:upper:]' '[:lower:]' | sed -e 's/[^a-z0-9()._-]//g' 31 | } 32 | 33 | for certificate in $(ls /etc/ssl/certs/*.pem) ; do 34 | cert=$($jdk/bin/keytool -printcert -file $certificate) 35 | issuer=$(echo "$cert" | grep '^Issuer' | cut -d' ' -f1 --complement) 36 | fprint=$(echo "$cert" | grep 'SHA1:' | cut -d' ' -f3) 37 | alias=$(get_alias "$issuer") 38 | echo "Adding $fprint ($alias, $certificate)" 39 | ${jdk}/bin/keytool -importcert -noprompt -alias "${alias}" -storepass changeit -storetype JKS -keystore cacerts -file "${certificate}" || \ 40 | ${jdk}/bin/keytool -importcert -noprompt -alias "${alias}_1" -storepass changeit -storetype JKS -keystore cacerts -file "${certificate}" # Since there was a certificate that ended up getting the same alias (.pem versus _1.pem) 41 | done 42 | 43 | rm $jdk/lib/security/cacerts 44 | mv cacerts $jdk/lib/security/cacerts 45 | 46 | -------------------------------------------------------------------------------- /flathub.json: -------------------------------------------------------------------------------- 1 | { 2 | "skip-icons-check": true 3 | } 4 | -------------------------------------------------------------------------------- /org.freedesktop.Sdk.Extension.openjdk.appdata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | org.freedesktop.Sdk.Extension.openjdk 5 | CC0-1.0 6 | 0BSD AND Apache-1.1 AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND FTL AND GPL-2.0 AND GPL-2.0-with-classpath-exception AND IJG AND ISC AND LGPL-2.1-or-later AND MIT AND MPL-2.0 AND RSA-MD AND SAX-PD AND W3C AND Zlib 7 | OpenJDK SDK Extension 8 | The latest version of the OpenJDK JRE and JDK 9 | 10 |

11 | This SDK extension allows the building and running of Java-based applications. 12 |

13 |
14 | https://openjdk.java.net/ 15 | https://bugs.openjdk.java.net/ 16 | Mat Booth 17 | mat.booth@gmail.com 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | https://github.com/openjdk/jdk/releases/tag/jdk-23%2B37 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
42 | -------------------------------------------------------------------------------- /org.freedesktop.Sdk.Extension.openjdk.yaml: -------------------------------------------------------------------------------- 1 | id: org.freedesktop.Sdk.Extension.openjdk 2 | branch: '24.08' 3 | runtime: org.freedesktop.Sdk 4 | runtime-version: '24.08' 5 | build-extension: true 6 | sdk: org.freedesktop.Sdk 7 | separate-locales: false 8 | cleanup: 9 | - /share/info 10 | - /share/man 11 | build-options: 12 | no-debuginfo: true 13 | strip: true 14 | prefix: /usr/lib/sdk/openjdk 15 | env: 16 | V: '1' 17 | modules: 18 | - name: bootstrap_jdk 19 | buildsystem: simple 20 | cleanup: 21 | - '*' 22 | sources: 23 | - type: file 24 | only-arches: 25 | - x86_64 26 | url: https://github.com/adoptium/temurin23-binaries/releases/download/jdk-23.0.2%2B7/OpenJDK23U-jdk_x64_linux_hotspot_23.0.2_7.tar.gz 27 | dest-filename: java-openjdk.tar.bz2 28 | sha512: cd3f0f1f5ae97286895d1c243a86193fe31791652bd780d5bfc6062b4421f7111da9fe6ae91071a06aa928626ab710693b3cf6b12a6c9b5f1f9e2148b67c9540 29 | x-checker-data: 30 | type: json 31 | url: https://api.adoptium.net/v3/assets/latest/23/hotspot?os=linux&architecture=x64&image_type=jdk 32 | version-query: .[0].version.semver 33 | url-query: .[0].binary.package.link 34 | - type: file 35 | only-arches: 36 | - aarch64 37 | url: https://github.com/adoptium/temurin23-binaries/releases/download/jdk-23.0.2%2B7/OpenJDK23U-jdk_aarch64_linux_hotspot_23.0.2_7.tar.gz 38 | dest-filename: java-openjdk.tar.bz2 39 | sha512: 70e0a4f040689587da8757821d1ada3b5dc6ac407a336c39f458f91c960f3cb744bb05eb7a6d71885d5d014034c1f5fd5c56c5f2bdd8497e4d22ad353c95afc7 40 | x-checker-data: 41 | type: json 42 | url: https://api.adoptium.net/v3/assets/latest/23/hotspot?os=linux&architecture=aarch64&image_type=jdk 43 | version-query: .[0].version.semver 44 | url-query: .[0].binary.package.link 45 | build-commands: 46 | - mkdir -p $FLATPAK_DEST/bootstrap-java 47 | - tar xf java-openjdk.tar.bz2 --strip-components=1 --directory=$FLATPAK_DEST/bootstrap-java 48 | - name: java 49 | buildsystem: autotools 50 | no-make-install: true 51 | no-parallel-make: true 52 | config-opts: 53 | - --with-boot-jdk=/usr/lib/sdk/openjdk/bootstrap-java 54 | - --with-jvm-variants=server 55 | - --with-version-build=7 56 | - --with-version-pre= 57 | - --with-version-opt= 58 | - --with-vendor-version-string=24.9 59 | - --with-vendor-name=Flathub 60 | - --with-vendor-url=https://flathub.org 61 | - --with-vendor-bug-url=https://github.com/flathub/org.freedesktop.Sdk.Extension.openjdk/issues 62 | - --with-debug-level=release 63 | - --with-native-debug-symbols=internal 64 | - --enable-unlimited-crypto 65 | - --with-zlib=system 66 | - --with-libjpeg=system 67 | - --with-giflib=system 68 | - --with-libpng=system 69 | - --with-lcms=system 70 | - --with-harfbuzz=system 71 | - --with-stdc++lib=dynamic 72 | - --with-extra-cxxflags=-grecord-gcc-switches -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS 73 | -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection 74 | - --with-extra-cflags=-grecord-gcc-switches -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS 75 | -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection 76 | - --with-extra-ldflags=-Wl,-z,relro -Wl,-z,now -Wl,--as-needed 77 | - --disable-javac-server 78 | - --disable-warnings-as-errors 79 | make-args: 80 | - LOG=info 81 | - images 82 | post-install: 83 | - mkdir -p $FLATPAK_DEST/jvm/ $FLATPAK_DEST/bin 84 | - cp -Lr build/linux-*-server-release/images/jdk $FLATPAK_DEST/jvm/openjdk-23 85 | - ln -s $FLATPAK_DEST/jvm/openjdk-23/bin/* $FLATPAK_DEST/bin 86 | sources: 87 | - type: archive 88 | url: https://github.com/openjdk/jdk23u/archive/refs/tags/jdk-23.0.2+7.tar.gz 89 | sha512: e96abf66cd62c307f71c3a70367a9147e250d84f69c685bfef97f901a5414e1bb10c4702d81238554443b580e654ded41d476643f7649beafa0f3dd98ac4e499 90 | x-checker-data: 91 | type: json 92 | url: https://api.adoptium.net/v3/assets/latest/23/hotspot?os=linux&architecture=x64&image_type=jdk 93 | version-query: .[0].release_name 94 | url-query: '"https://github.com/openjdk/jdk23u/archive/refs/tags/" + $version 95 | + ".tar.gz"' 96 | is-main-source: true 97 | - type: shell 98 | commands: 99 | - chmod a+x configure 100 | - sed -i -e "s|@prefix@|$FLATPAK_DEST|" make/autoconf/spec.gmk.template 101 | - name: cacerts 102 | buildsystem: simple 103 | sources: 104 | - type: file 105 | path: extract_cacerts.sh 106 | build-commands: 107 | - ./extract_cacerts.sh $FLATPAK_DEST/jvm/openjdk-23 108 | - name: ant 109 | buildsystem: simple 110 | cleanup: 111 | - '*.bat' 112 | - '*.cmd' 113 | sources: 114 | - type: file 115 | url: http://archive.apache.org/dist/ant/binaries/apache-ant-1.10.15-bin.tar.gz 116 | dest-filename: apache-ant-bin.tar.gz 117 | sha512: d78427aff207592c024ff1552dc04f7b57065a195c42d398fcffe7a0145e8d00cd46786f5aa52e77ab0fdf81334f065eb8011eecd2b48f7228e97ff4cb20d16c 118 | x-checker-data: 119 | type: anitya 120 | project-id: 50 121 | stable-only: true 122 | url-template: http://archive.apache.org/dist/ant/binaries/apache-ant-$version-bin.tar.gz 123 | build-commands: 124 | - mkdir -p $FLATPAK_DEST/ant 125 | - tar xf apache-ant-bin.tar.gz --strip-components=1 --directory=$FLATPAK_DEST/ant 126 | - ln -s $FLATPAK_DEST/ant/bin/ant $FLATPAK_DEST/bin 127 | - name: maven 128 | buildsystem: simple 129 | cleanup: 130 | - '*.bat' 131 | - '*.cmd' 132 | sources: 133 | - type: file 134 | url: http://archive.apache.org/dist/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz 135 | dest-filename: apache-maven-bin.tar.gz 136 | sha512: a555254d6b53d267965a3404ecb14e53c3827c09c3b94b5678835887ab404556bfaf78dcfe03ba76fa2508649dca8531c74bca4d5846513522404d48e8c4ac8b 137 | x-checker-data: 138 | type: anitya 139 | project-id: 1894 140 | stable-only: true 141 | url-template: http://archive.apache.org/dist/maven/maven-3/$version/binaries/apache-maven-$version-bin.tar.gz 142 | build-commands: 143 | - mkdir -p $FLATPAK_DEST/maven 144 | - tar xf apache-maven-bin.tar.gz --strip-components=1 --exclude=jansi-native 145 | --directory=$FLATPAK_DEST/maven 146 | - ln -s $FLATPAK_DEST/maven/bin/mvn $FLATPAK_DEST/maven/bin/mvnDebug $FLATPAK_DEST/bin 147 | - name: gradle 148 | buildsystem: simple 149 | cleanup: 150 | - '*.bat' 151 | sources: 152 | - type: file 153 | url: https://services.gradle.org/distributions/gradle-8.12.1-bin.zip 154 | dest-filename: gradle-bin.zip 155 | sha512: 816d90f7af71f83fbf21b1216c4cdbd64814b109815dfef2a0adced19c598877c781e078ec01f86bfbb830b1dee07483642b5872cdf5a380c0c7da0a8a3a884a 156 | x-checker-data: 157 | type: json 158 | url: https://api.github.com/repos/gradle/gradle/releases 159 | version-query: map(select(.prerelease == false)) | first | .name 160 | url-query: '["https://services.gradle.org/distributions/gradle-" + $version 161 | + "-bin.zip"][0]' 162 | build-commands: 163 | - unzip -q gradle-bin.zip -d $FLATPAK_DEST 164 | - mv $FLATPAK_DEST/gradle-* $FLATPAK_DEST/gradle 165 | - ln -s $FLATPAK_DEST/gradle/bin/gradle $FLATPAK_DEST/bin 166 | - name: scripts 167 | buildsystem: simple 168 | sources: 169 | - type: script 170 | commands: 171 | - mkdir -p /app/jre/bin 172 | - cd /usr/lib/sdk/openjdk/jvm/openjdk-23 173 | - cp -ra conf lib release /app/jre/ 174 | - rm /app/jre/lib/src.zip /app/jre/lib/ct.sym 175 | - cp -ra bin/{java,keytool,rmiregistry} /app/jre/bin 176 | dest-filename: install.sh 177 | - type: script 178 | commands: 179 | - mkdir -p /app/jdk/ 180 | - cd /usr/lib/sdk/openjdk/jvm/openjdk-23 181 | - cp -ra bin conf include jmods lib release /app/jdk/ 182 | dest-filename: installjdk.sh 183 | - type: script 184 | commands: 185 | - export JAVA_HOME=/usr/lib/sdk/openjdk/jvm/openjdk-23 186 | - export PATH=$PATH:/usr/lib/sdk/openjdk/bin 187 | dest-filename: enable.sh 188 | build-commands: 189 | - cp enable.sh install.sh installjdk.sh /usr/lib/sdk/openjdk/ 190 | - name: appdata 191 | buildsystem: simple 192 | sources: 193 | - type: file 194 | path: org.freedesktop.Sdk.Extension.openjdk.appdata.xml 195 | build-commands: 196 | - mkdir -p ${FLATPAK_DEST}/share/metainfo 197 | - cp org.freedesktop.Sdk.Extension.openjdk.appdata.xml ${FLATPAK_DEST}/share/metainfo 198 | --------------------------------------------------------------------------------