Sdkman jdks
Index¶
- sdkman_jdks::get_jdk_major_version
- sdkman_jdks::install_jdk
- sdkman_jdks::uninstall_jdk
- sdkman_jdks::set_default_jdk_by_id
- sdkman_jdks::fetch_tem_jdk_catalog
- sdkman_jdks::catalog_cache_file
- sdkman_jdks::get_tem_jdk_catalog
- sdkman_jdks::get_formatted_all_tem_jdks
- sdkman_jdks::filter_for_installed
- sdkman_jdks::filter_for_major_version
- sdkman_jdks::filter_for_latest_per_major_version
- sdkman_jdks::get_formatted_tem_jdk_major_version_field
- sdkman_jdks::get_formatted_tem_jdk_version_field
- sdkman_jdks::get_formatted_tem_jdk_artifact_id_field
- sdkman_jdks::get_formatted_latest_available_tem_jdk_major_versions
- sdkman_jdks::get_formatted_latest_available_tem_jdk_for_major_version
- sdkman_jdks::get_available_tem_jdk_major_versions
- sdkman_jdks::get_latest_available_tem_jdk_major_version
- sdkman_jdks::check_available_tem_jdk_major_version
- sdkman_jdks::get_formatted_installed_tem_jdks
- sdkman_jdks::get_formatted_installed_tem_jdks_for_major_version
- sdkman_jdks::get_formatted_latest_installed_tem_jdk_major_versions
- sdkman_jdks::get_formatted_latest_installed_tem_jdk_for_major_version
- sdkman_jdks::get_installed_tem_jdk_major_versions
- sdkman_jdks::get_latest_installed_tem_jdk_major_version
- sdkman_jdks::check_installed_tem_jdk_major_version
- sdkman_jdks::is_tem_jdk_artifact_installed
- sdkman_jdks::get_latest_installed_tem_jdk_artifact_id_for_major_version
- sdkman_jdks::install_latest_tem_jdk
- sdkman_jdks::install_latest_tem_jdks
- sdkman_jdks::set_default_sdk_to_latest_installed_for_major_version
- sdkman_jdks::has_default_jdk
- sdkman_jdks::get_current_default_jdk_artifact_id
- sdkman_jdks::get_current_default_jdk_major_version
- sdkman_jdks::set_default_jdk_to_latest_patch_of_current_major
- sdkman_jdks::prune_tem_jdks_for_major_version
- sdkman_jdks::prune_tem_jdks
sdkman_jdks::get_jdk_major_version¶
Extract the major version number from a JDK version string or artifact ID. Output: stdout — major version number (e.g. "21")
Arguments¶
- $1 (version): string or artifact ID (e.g. "21.0.3-tem" or "21")
sdkman_jdks::install_jdk¶
Install a specific JDK artifact via SDKMAN.
Arguments¶
- $1 (jdk): artifact ID (e.g. "21.0.3-tem")
sdkman_jdks::uninstall_jdk¶
Uninstall a specific JDK artifact via SDKMAN.
Arguments¶
- $1 (jdk): artifact ID (e.g. "21.0.3-tem")
sdkman_jdks::set_default_jdk_by_id¶
Set the given JDK artifact as the SDKMAN default for java.
Arguments¶
- $1 (artifact): ID (e.g. "21.0.3-tem")
sdkman_jdks::fetch_tem_jdk_catalog¶
Fetch the remote Temurin JDK catalog, newest first. Always performs a network
round-trip: sdk list java issues an uncached HTTPS request to the SDKMAN API.
Callers want sdkman_jdks::get_tem_jdk_catalog, which memoizes this per process.
The installed/in-use markers sdk list java prints are deliberately discarded — installed
state is owned by the candidates dir (see sdkman_jdks::get_formatted_installed_tem_jdks).
Vendor rows are selected by the -tem suffix on the trailing Identifier column, not by a
fixed field index: SDKMAN dropped the Dist and Status columns from the table, so the old
$4 == tem / print-$6 form silently matched nothing and every caller saw an empty catalog
— sdkman-clean died with "Java version 8 is not available" and sdkman-update skipped
every JDK without a word. Keying on $NF parses the 4-column and 6-column layouts alike.
Rows SDKMAN marks "local only" are dropped: those versions sit in the candidates dir but the
API no longer serves them, so they are not available to install, and every consumer of this
catalog means exactly that. Left in, one that sorted above the newest remote row for its major
would make install_latest_tem_jdk hand sdk install java an undownloadable artifact and make
prune_tem_jdks_for_major_version keep it while uninstalling the current one.
The marker is matched by shape rather than by column, for the same reason $NF is: it is a
+ among the Use column's > * + glyphs today and was the literal text local only in the
six-column layout's Status column. No other cell can collide — a Version always carries
digits, an Identifier ends in -tem, and a Vendor is alphabetic.
Output: stdout — lines with fields: major;version;artifact-id
shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::catalog_cache_file¶
Print the path of this process's Temurin catalog memo file. Keyed on $$, which — unlike BASHPID — is stable inside subshells and pipeline segments, so every caller in a pipeline resolves the same path. Lives under XDG_RUNTIME_DIR because that directory is per-user and mode 0700, so a predictable filename there carries none of the symlink-hijack risk the same name would carry in a world-writable /tmp. Output: stdout — absolute path to this process's memo file shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_tem_jdk_catalog¶
Print the Temurin JDK catalog, fetching it at most once per process. The memo is a file rather than a variable because callers invoke this from inside pipelines, and a pipeline segment runs in a subshell whose variable writes are discarded — a variable memo would never register a single hit. Output: stdout — lines with fields: major;version;artifact-id shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_formatted_all_tem_jdks¶
Print all available Temurin JDKs in semicolon-delimited format, newest first.
The catalog half is memoized per process, so this costs at most one sdk list java round-trip
per run no matter how many times it is called. The installed column is re-derived from the
candidates dir on every call, so it stays correct across installs and uninstalls within a run
and the memo never needs invalidating.
Output: stdout — lines with fields: major;version;artifact-id;installed('y'/'n')
shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::filter_for_installed¶
Filter formatted JDK lines (from stdin) to only those marked as installed. Output: stdout — matching lines in semicolon-delimited format shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::filter_for_major_version¶
Filter formatted JDK lines (from stdin) to only those matching the given major version. Output: stdout — matching lines in semicolon-delimited format
Arguments¶
- $1 (major): version number
sdkman_jdks::filter_for_latest_per_major_version¶
Filter formatted JDK lines (from stdin) to retain only the first (latest) entry per major version. Output: stdout — one line per major version in semicolon-delimited format shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_formatted_tem_jdk_major_version_field¶
Extract the major version field (column 1) from semicolon-delimited JDK lines on stdin. Output: stdout — major version numbers, one per line shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_formatted_tem_jdk_version_field¶
Extract the full version field (column 2) from semicolon-delimited JDK lines on stdin. Output: stdout — version strings, one per line shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_formatted_tem_jdk_artifact_id_field¶
Extract the artifact ID field (column 3) from semicolon-delimited JDK lines on stdin. Output: stdout — artifact IDs, one per line shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_formatted_latest_available_tem_jdk_major_versions¶
Print the latest available Temurin JDK entry per major version in semicolon-delimited format. Output: stdout — one line per major version: major;version;artifact-id;installed('y'/'n') shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_formatted_latest_available_tem_jdk_for_major_version¶
Print the latest available Temurin JDK entry for the given major version in semicolon-delimited format. Output: stdout — one line: major;version;artifact-id;installed('y'/'n')
Arguments¶
- $1 (major): java version
sdkman_jdks::get_available_tem_jdk_major_versions¶
Print all available Temurin JDK major version numbers, sorted numerically. Output: stdout — major version numbers, one per line shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_latest_available_tem_jdk_major_version¶
Print the highest available Temurin JDK major version number. Output: stdout — major version number (e.g. "21") shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::check_available_tem_jdk_major_version¶
Die if the given major version is not available in the SDKMAN Temurin JDK list.
Arguments¶
- $1 (major): java version
sdkman_jdks::get_formatted_installed_tem_jdks¶
Print all installed Temurin JDK entries in semicolon-delimited format, newest first.
Reads the SDKMAN candidates directory rather than sdk list java, so it performs no network I/O
— sdk list java issues an uncached HTTPS request to the SDKMAN API on every invocation, which
dominated the runtime of every caller that looped over installed JDKs.
Output: stdout — lines with fields: major;version;artifact-id;installed('y')
shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_formatted_installed_tem_jdks_for_major_version¶
Print installed Temurin JDK entries for the given major version in semicolon-delimited format. Output: stdout — lines with fields: major;version;artifact-id;installed('y')
Arguments¶
- $1 (major): version
sdkman_jdks::get_formatted_latest_installed_tem_jdk_major_versions¶
Print the latest installed Temurin JDK entry per major version in semicolon-delimited format. Output: stdout — one line per major version: major;version;artifact-id;installed('y') shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_formatted_latest_installed_tem_jdk_for_major_version¶
Print the latest installed Temurin JDK entry for the given major version in semicolon-delimited format. Output: stdout — one line: major;version;artifact-id;installed('y')
Arguments¶
- $1 (major): java version
sdkman_jdks::get_installed_tem_jdk_major_versions¶
Print all installed Temurin JDK major version numbers, sorted numerically. Output: stdout — major version numbers, one per line shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_latest_installed_tem_jdk_major_version¶
Print the highest installed Temurin JDK major version number. Output: stdout — major version number (e.g. "21") shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::check_installed_tem_jdk_major_version¶
Die if the given major version has no installed Temurin JDK.
Arguments¶
- $1 (major): java version
sdkman_jdks::is_tem_jdk_artifact_installed¶
Return true if a Temurin JDK with the given artifact ID is currently installed. A direct candidate-dir test rather than a scan of the formatted installed list: this is called once per catalog line while annotating sdkman_jdks::get_formatted_all_tem_jdks, where the pipeline form would fork several processes per line.
Arguments¶
- $1 (artifact): ID (e.g. "21.0.3-tem")
Exit codes¶
- 0: if true
- 1: if false
sdkman_jdks::get_latest_installed_tem_jdk_artifact_id_for_major_version¶
Print the artifact ID of the latest installed Temurin JDK for the given major version. Output: stdout — artifact ID (e.g. "21.0.3-tem")
Arguments¶
- $1 (major): java version
sdkman_jdks::install_latest_tem_jdk¶
Install the latest available Temurin JDK for the given major version.
Arguments¶
- $1 (major): version
sdkman_jdks::install_latest_tem_jdks¶
Install the latest available Temurin JDK for every available major version. shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::set_default_sdk_to_latest_installed_for_major_version¶
Set the SDKMAN default java to the latest installed Temurin JDK for the given major version.
Arguments¶
- $1 (major): java version
sdkman_jdks::has_default_jdk¶
Return true if a default java is currently set (the SDKMAN java/current symlink exists).
Function has no arguments.
Exit codes¶
- 0: if a default java is set
- 1: if no default java is set
sdkman_jdks::get_current_default_jdk_artifact_id¶
Print the artifact ID of the current default java. Dies if no default is set. Output: stdout — artifact ID (e.g. "17.0.10-tem") shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::get_current_default_jdk_major_version¶
Print the major version of the current default java. Dies if no default is set. Output: stdout — major version number (e.g. "17") shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::set_default_jdk_to_latest_patch_of_current_major¶
Set the SDKMAN default java to the latest installed Temurin JDK of the current default's major version. Falls back to the highest installed major version when no default is currently set. shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.
sdkman_jdks::prune_tem_jdks_for_major_version¶
Uninstall all installed Temurin JDKs for the given major version except the latest available.
Refuses to act when the latest available artifact is not itself installed: every installed
artifact then differs from the keeper, so the sweep would leave the major with nothing
installed at all. That is reachable whenever the newest remote artifact has not been pulled
down yet — and an artifact SDKMAN has since stopped serving cannot be reinstalled once it is
gone. Install the keeper first (sdkman-update does), then prune on the next run.
Repoints the java/current symlink at the keeper first when the default is one of the artifacts
about to go: sdk uninstall refuses to remove the artifact current points at and exits 1,
which killed the whole prune sweep under errexit.
Arguments¶
- $1 (major): java version
Output on stderr¶
- A warning naming the major version when pruning is declined for the reason above.
sdkman_jdks::prune_tem_jdks¶
Uninstall all outdated installed Temurin JDKs across every installed major version. shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites
Function has no arguments.