activeviam / jdk4py

A JDK shipped in a Python package
GNU General Public License v2.0
18 stars 5 forks source link
java jdk jre jvm python-library runtime

jdk4py

A JDK shipped in a Python package.

PyPI version

Install

pip install jdk4py

or as a Conda package:

conda config --add channels https://conda.atoti.io
conda install jdk4py

Usage

>>> from jdk4py import JAVA, JAVA_HOME, JAVA_VERSION
>>> JAVA_HOME
PosixPath('/Users/johndoe/dev/jdk4py/jdk4py/java-runtime')
>>> JAVA
PosixPath('/Users/johndoe/dev/jdk4py/jdk4py/java-runtime/bin/java')
>>> JAVA_VERSION
(21, 0, 4)
>>> from subprocess import check_output
>>> some_java_options = ["-Xmx16G", "-Xms2G"]
>>> check_output([JAVA, "-jar", "HelloWorld.jar",  *some_java_options])
b"Hello, World!"

Versioning

jdk4py's version contains 4 numbers: