Skip to content

OpenJDK

Version: 1.0.0 | Tests: Passing

devcontainer.json
{
    "features": {
        "ghcr.io/infrashift/trusted-devcontainer-features/openjdk:latest": {
            "target_major_version": "21",
            "target_version": "21.0.6+7"
        }
    }
}
OptionTypeDefaultDescription
target_major_versionstring21Select the OpenJDK major version
target_versionstring21.0.6+7Select the full OpenJDK version string
target_checksumstring""SHA256 checksum for the OpenJDK tarball

None — this feature is independent and has no dependencies.

This feature downloads Eclipse Temurin OpenJDK from the Adoptium project. The Ansible playbook downloads the JDK tarball for the specified major and full version (OpenJDK<major>U-jdk_x64_linux_hotspot_<version>.tar.gz), optionally verifies the SHA256 checksum if one is provided, and extracts it to ~/.local/share/java.

After extraction, the playbook configures JAVA_HOME to point to the installed JDK directory and adds the JDK bin directory to PATH, making java, javac, and all other JDK tools immediately available. The VS Code Java Extension Pack is recommended for a full-featured Java development experience in the devcontainer.

This is the only feature in the collection that uses a separate major version option (target_major_version) in addition to the full version string (target_version). The major version is needed because the Adoptium download URL structure uses the major version in the path, while the full version string (e.g., 21.0.6+7) is used for the tarball filename. Both values must be provided and must be consistent with each other for the download to succeed.