Projects such as LangChain4j, Spring AI, and llama3.java got the Java community very excited about AI in the last year. The Python ecosystem also provides many powerful packages for data science, machine learning, and more. Wouldn't it be cool if you, as a Java developer, could benefit from this, too?
In this interactive talk, we show how you can use GraalPy, the Python runtime built by the GraalVM team, to embed Python in your Java applications. We'll start simple with adding GraalPy as a dependency to a minimal Java project and show how easy it is to get started and evaluate Python code. We then show how the Maven and Gradle plugins for GraalPy can help install additional Python packages. We continue with more live demos that illustrate different use cases, such as: a Spring Boot application that performs sentiment analysis with Python, a Micronaut application that uses a Python package for data visualization, Python running on JBang!, and a Java application scripted with Python.
We'll also look beyond Python and provide examples of how to embed other languages. You can, for example, also use JavaScript for server-side rendering or scripting of Java applications. You can even compile user-defined functions written in C++ or Rust, compile them to WebAssembly, and embed them in Java.
Come and join us to learn more and don't be shy to ask questions!
Fabio Niephaus, Oracle Labs
Tim Felgentreff, Oracle
Recorded at Jfokus 2025 in Stockholm 5th of february
http://www.jfokus.se