--- id: pyjnius version: "1.7.0" license: unclear license_treatment: permissive maintenance: active --- # pyjnius — A Python library for accessing access Java classes as using the Java Native Interface (JNI). License: permissive · Maintenance: active · Downloads: 295.3K/mo ## What it is and what it does PyJNIus is a Python library that bridges Python and Java by exposing Java classes and methods to Python code via the Java Native Interface (JNI). It lets you instantiate Java objects, call methods, access fields, and work with Java data types directly from Python—all without writing native C code yourself. The library is managed by the Kivy team and works on desktop (macOS, Linux, Windows) and mobile (Android) platforms. You can use it two ways: with autoclass() for dynamic discovery of all Java class members, or by manually declaring JavaClass subclasses with specific methods and fields for finer control. It's commonly used in Kivy mobile apps to access Android hardware and in desktop applications that need to leverage existing Java libraries or interact with the JVM. Use it for: - Access Android hardware sensors and APIs from a Python mobile app built with Kivy. - Call Java utility classes and data structures from Python without rewriting them. - Integrate Python scripts with existing Java libraries or legacy Java codebases on desktop systems. - Build cross-platform mobile apps where Python handles UI logic and Java handles platform-specific functionality. - Prototype or automate Java applications by scripting them from Python. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. PyJNIus lets Python code call Java classes and methods directly using the Java Native Interface (JNI), enabling interoperability between Python and Java on desktop and mobile platforms. Yes, if you need Python–Java interoperability. PyJNIus is actively maintained, MIT-licensed, widely used, has no known vulnerabilities, and ships pre-built wheels for modern Python versions. The main requirement is having a JDK installed and configured—a one-time setup cost. Install it if you're building a Kivy mobile app, integrating Python with Java libraries, or automating JVM-based systems. ## Install pip install pyjnius uv add pyjnius poetry add pyjnius ## Installing pyjnius Before you install: Medium install friction: the package ships pre-built wheels for Python 3.10, 3.11, 3.12, and 3.13 across macOS, Linux, Windows, and ARM platforms, but requires a Java Development Kit (JDK) to be installed and configured on your system. On Windows, JAVA_HOME must be set; on macOS and Linux it is usually auto-detected. The project is actively maintained with recent activity. License in practice: PyJNIus is MIT licensed (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects. Quickstart: pip install pyjnius from jnius import autoclass Stack = autoclass('java.util.Stack') stack = Stack() stack.push('hello') print(stack.pop()) A Java Development Kit (JDK) must be installed and JAVA_HOME configured on Windows; on macOS and Linux, JDK is typically auto-detected. Verify before relying: - Whether pre-built wheels include JNI headers or if compilation from source requires additional build tools. - Performance overhead of the Python–Java bridge for high-frequency method calls. - Compatibility with alternative JVM implementations beyond standard OpenJDK. ## Package facts - License: not declared (permissive) - Python support: unspecified - Install friction: medium - Maintenance: active - Downloads: 295.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python java interop jni, call java from python, java native interface python, python android java bridge, jni wrapper python, java class access python, python jvm integration, java-interop, jni-bridge, android-kivy [View on SkillFed](https://skillfed.io/packages/pyjnius) · [View on PyPI](https://pypi.org/project/pyjnius/)