funcdownload#

download(
component: str,
*,
cache_dir: Path | None = None,
session: Session | None = None,
progress: Callable[[Progress], None] | None = None,
cancel: CancelToken | None = None,
index_url: str = 'https://launchermeta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json',
) → JavaRuntime#

Download a Mojang runtime into the cache, never the launcher’s directory.

Files that are already valid are kept, so an interrupted download can be run again.

Parameters:
  • component (str) – The runtime component, such as java-runtime-delta.

  • cache_dir (Path | None) – The cache directory. Defaults to the per-user cache.

  • session (Session | None) – The session to use. A temporary one is created if omitted.

  • progress (Callable[[Progress], None] | None) – Receives download updates.

  • cancel (CancelToken | None) – Stops the download.

  • index_url (str) – Where to read Mojang’s runtime index.

Returns:

The installed runtime.

Raises:
  • JavaError – Mojang has no such runtime for this platform, or it is corrupt.

  • NetworkError – The runtime index could not be fetched.

  • DownloadError – A file could not be downloaded.

  • Cancelled – cancel was triggered.

Return type:

JavaRuntime