PemJa is a Python-Java bridge that enables embedding a JVM within a Python process, allowing dynamic interaction with Java objects and classes. It simplifies calling Java methods from Python and provides mechanisms for classpath management. The current version is 0.6.1, with releases occurring as features are added or bugs are fixed, but without a strict regular cadence.
pip install pemjaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates launching a JVM, accessing static Java methods, creating Java object instances, calling instance methods, and basic Java exception handling. It's crucial to have JDK 8+ installed on your system for PemJa to function.
Review the PemJa documentation for `launch_jvm` (e.g., on GitHub) and update your calls to use the new explicit parameters. For general JVM arguments, use the `options` list (e.g., `options=['-Xmx512m']`).
Install JDK 8+ and ensure its `bin` directory is in your system's PATH environment variable, or set the `JAVA_HOME` environment variable to point to your JDK installation directory.
Call `pemja.launch_jvm()` once at the beginning of your application. Store the returned `jvm` object and reuse it throughout your application. Use a context manager (`with pemja.launch_jvm() as jvm:`) for safe shutdown.
Use `pemja.find_jar()` to locate JARs and pass the result to the `classpath` argument of `pemja.launch_jvm()`. For multiple JARs, `classpath` accepts a list of paths.
No dependency data recorded yet.