Registry / devops / install-jdk

install-jdk

JSON →
library1.1.0pypypi✓ verified 84d ago

install-jdk is a Python library that simplifies the process of installing OpenJDK distributions. It supports popular OpenJDK builds from Adoptium (formerly AdoptOpenJDK), Amazon Corretto, and Zulu, allowing developers to easily manage Java environments. The current version is 1.1.0, and it maintains a moderate release cadence with updates for dependencies and minor features.

pip install install-jdk
INSTALL
IMPORT
SIG · INSTALL-JDK
I
install-jdk
devopspythonv1.1.0
Install
1.5s avg
Import
168ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.174s · 17.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.163s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

jdk
import jdk

This quickstart installs the latest OpenJDK 17 from Adoptium to a specified directory (defaulting to a temporary path to avoid permissions issues). It demonstrates the core `jdk.install()` function and prints the installation path. Users would typically use this `install_path` to configure their `JAVA_HOME` environment variable or invoke the Java executable directly.

import jdk import os # Install the latest OpenJDK 17 from Adoptium to a temporary directory # This makes it runnable without affecting user's home directory install_path = jdk.install( '17', jvm_impl='adoptium', install_dir=os.environ.get('JDK_INSTALL_DIR', '/tmp/jdk_install_cache') ) print(f"OpenJDK 17 installed at: {install_path}") # You can then use this path to set JAVA_HOME or run Java commands # For example, to print the Java version: # import subprocess # java_bin = os.path.join(install_path, 'bin', 'java') # if os.path.exists(java_bin): # try: # result = subprocess.run([java_bin, '-version'], capture_output=True, text=True, check=True) # print(result.stderr) # Java version typically prints to stderr # except subprocess.CalledProcessError as e: # print(f"Error running Java: {e.stderr}")
install-jdk --version
Debug
Known issues
gotchainstall-jdk installs JDKs to a local cache directory (e.g., `~/.jdk` or a custom `install_dir`), but it does not automatically modify system-wide PATH or set `JAVA_HOME` for your operating system. You must manually configure these environment variables for applications to find the installed JDK.
fix
After `jdk.install()` returns the `install_path`, manually set your `JAVA_HOME` environment variable to this path and add `$JAVA_HOME/bin` to your system's PATH. For example, `export JAVA_HOME=/path/to/installed/jdk`.
affects: All versions
gotchaThe library explicitly requires Python versions `>=3.6,<4.0`. Using Python 3.10 or newer will result in installation errors or unexpected runtime behavior.
fix
Ensure you are using a compatible Python version (3.6-3.9). It is recommended to use a virtual environment with the correct Python interpreter version for `install-jdk`.
affects: All versions
gotchaJDK installation requires active internet access to download binaries from remote servers. Network issues, firewalls, or proxy configurations can cause installation failures.
fix
Verify your internet connection. If you are behind a corporate proxy, ensure your Python environment's proxy settings (e.g., `HTTP_PROXY`, `HTTPS_PROXY` environment variables) are correctly configured.
affects: All versions
gotchaWhen calling `jdk.install()`, if you omit `jvm_impl`, it defaults to 'adoptium'. If you expect a different vendor (e.g., Corretto or Zulu), you must explicitly specify it.
fix
Always specify the `jvm_impl` argument, e.g., `jdk.install('11', jvm_impl='corretto')`, to ensure you get the desired JDK distribution.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'jdk'
The `install-jdk` package was not installed or is not accessible in the current Python environment.
fix
Run `pip install install-jdk` in your active virtual environment or global Python installation.
ValueError: Could not find a suitable JDK version for '1.8' (or similar for other versions/impls)
The specified JDK version, JVM implementation, or variant combination could not be found or is not supported by the available providers. This can happen with very old, pre-release, or incorrect version strings.
fix
Double-check the exact version string (e.g., use '8' instead of '1.8' for Java 8, or '17' for Java 17). Verify the `jvm_impl` (e.g., 'adoptium', 'corretto', 'zulu') and `jvm_variant` (e.g., 'hotspot', 'openjdk') are correct and supported.
PermissionError: [Errno 13] Permission denied: '/path/to/.jdk'
The user running `install-jdk` does not have write permissions to the default installation directory (usually `~/.jdk`) or a custom `install_dir` provided.
fix
Run the script with appropriate user permissions, or specify an `install_dir` where the user has write access, e.g., `jdk.install('17', install_impl='adoptium', install_dir='/tmp/my_jdks')`.
Upgrade
Version history
1.1.0latest on PyPI · released Jul 21, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
install-jdk — pip install install-jdk · libregistry