We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Supercharge your Java Applications with Python! by Fabio Niephaus, Thomas Wuerthinger
Learn how to seamlessly integrate Python code into Java apps with GraalPy. Discover benefits like shared memory, single process deployment & IDE debugging support.
-
GraalPy allows Java developers to embed Python code within Java applications while maintaining full control and security through sandboxing capabilities
-
Languages like GraalPy, GraalJS, and GraalWasm can run on any OpenJDK distribution, not just GraalVM - they’re implemented as regular Java libraries accessible via Maven/Gradle dependencies
-
Integration is straightforward through Maven/Gradle dependencies - only requires Java 21+ and adding the polyglot package plus specific language dependencies
-
Major benefits include:
- No data/memory overhead between languages
- Single process deployment
- Shared garbage collection
- Full IDE support including debugging
- Production-ready performance
-
Currently supports Python 3.11 with work ongoing for 3.12 compatibility, along with the top 500 Python packages
-
Native Python extensions require recompilation for GraalPy, but the team is working on automating this process and publishing pre-compiled versions to Maven Central
-
Multi-threading considerations:
- Python contexts should be pooled for multi-threaded applications
- Single Python context cannot be used across multiple threads
-
Real-world production usage examples:
- IntelliJ IDEA using GraalJS for HTTP client execution
- Oracle Database embedding
- Amazon implementations
-
Build options include:
- Regular JIT compilation
- Native image compilation
- Interpreter-only mode for smaller deployments
-
Active development continues on framework integrations with Spring, Micronaut, and Quarkus to provide more convenient developer experiences