SlideShare a Scribd company logo
Mixing Python and Java How Python and Java can communicate  and work together EuroPython 2009 (June 30th 2009, Birmingham) Andreas Schreiber  <Andreas.Schreiber@dlr.de> German Aerospace Center (DLR), Cologne, Germany http://www.dlr.de/sc
Final Version of this Slides is  available on SlideShare http://tr.im/ep09java
Summary Java is being used for many existing applications in a variety of domains. Sometimes it is useful to integrate them with Python. For instance, one may wish to add embedded Python scripting to Java applications, to communicate with separate Python code written for CPython, or use existing Java libraries from Python code. The talk gives an overview of the various techniques, tools, and libraries for bridging Python and Java. In particular, the following implementations are described and compared: * Embedding of Python into Java with Jython. * Calling Java code from CPython scripts with JPype. * Calling CPython from Java code with JEPP. * Using inter process communication between Python and Java (e.g., with CORBA or SPIRO). Examples for all techniques are demonstrated, and use cases for the different approaches are presented with examples from real world applications.
Jython Java Virtual Machine Jython Python  Code Java Application Code
JEPP Python Interpreter Java Virtual Machine Java Application  Code Python  Code JNI JEPP
JPype Python Interpreter JNI JPype Python  Application Code Java Virtual Machine Java Application Code
JCC Python Interpreter JNI Python Code Java Virtual Machine Java Application Code pythonExtension() Generated C++ Wrapper Code JCC Code Generator
ORBs Java Virtual Machine Generated Java Code ( Stub ) Python Interpreter ORB Python  Application Code ( Server ) Generated  Python Code ( Skeleton ) Java Application Code ( Client ) IDL Compiler IDL
Web Services: SOAP Java Virtual Machine Servlet Container Java Application Code ( Server ) Python Interpreter Generated  Python Code ( Stub ) Python  Application Code ( Client ) Generated Java Code ( Skeleton ) WSDL Compiler WSDL
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java
Mixing Python and Java

More Related Content

PDF
FlumeJava: Easy, Efficient Data-Parallel Pipelines
PPT
Communication between Java and Python
PDF
LF_APIStrat17_OpenAPI and gRPC Side-by-Side
PDF
OpenAPI and gRPC Side by-Side
PDF
Build Great Networked APIs with Swift, OpenAPI, and gRPC
PDF
Возможности интерпретатора Python в NX-OS
PDF
20210517-PYTHON AI&DS PROGRAMMING NOTES.pdf
PDF
20210517-PYTHON AI&DS PROGRAMMING NOTES.pdf
FlumeJava: Easy, Efficient Data-Parallel Pipelines
Communication between Java and Python
LF_APIStrat17_OpenAPI and gRPC Side-by-Side
OpenAPI and gRPC Side by-Side
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Возможности интерпретатора Python в NX-OS
20210517-PYTHON AI&DS PROGRAMMING NOTES.pdf
20210517-PYTHON AI&DS PROGRAMMING NOTES.pdf

Similar to Mixing Python and Java (20)

PPT
Cmpe202 01 Research
PDF
Code Clash Python vs Java — Which Language Wins.pdf
PPTX
Python Training in Pune - Ethans Tech Pune
ODP
Scripting in OpenOffice.org
PDF
Python Developer Certification
PPTX
Advance Android Application Development
PPTX
EclipseOMRBuildingBlocks4Polyglot_TURBO18
ODP
Django On Jython (for Portland and Boulder Python user groups presentations)
PDF
Python_final_print_vison_academy_9822506209.pdf
PPTX
Python 101 for the .NET Developer
PDF
Python_final_print_batch_II_vision_academy.pdf
PDF
Python_final_print_batch_II_vision_academy.pdf
PDF
Python_vision_academy notes
PDF
Python_final_print_batch_II_vision_academy.pdf
PDF
Python_final_print_batch_II_vision_academy (1).pdf
PPT
Introduction to python
PPTX
python.pptx
PPT
Prelims Coverage for Int 213
PDF
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PPSX
Java Semimar Slide (Cetpa)
Cmpe202 01 Research
Code Clash Python vs Java — Which Language Wins.pdf
Python Training in Pune - Ethans Tech Pune
Scripting in OpenOffice.org
Python Developer Certification
Advance Android Application Development
EclipseOMRBuildingBlocks4Polyglot_TURBO18
Django On Jython (for Portland and Boulder Python user groups presentations)
Python_final_print_vison_academy_9822506209.pdf
Python 101 for the .NET Developer
Python_final_print_batch_II_vision_academy.pdf
Python_final_print_batch_II_vision_academy.pdf
Python_vision_academy notes
Python_final_print_batch_II_vision_academy.pdf
Python_final_print_batch_II_vision_academy (1).pdf
Introduction to python
python.pptx
Prelims Coverage for Int 213
PYTHON PROGRAMMING NOTES RKREDDY.pdf
Java Semimar Slide (Cetpa)
Ad

More from Andreas Schreiber (20)

PPTX
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
PPTX
Visualization of Software Architectures in Virtual Reality and Augmented Reality
PPTX
Provenance as a building block for an open science infrastructure
PPTX
Raising Awareness about Open Source Licensing at the German Aerospace Center
PDF
Open Source Licensing for Rocket Scientists
PDF
Interactive Visualization of Software Components with Virtual Reality Headsets
PPTX
Provenance for Reproducible Data Science
PPTX
Visualizing Provenance using Comics
PPTX
Quantified Self Comics
PPTX
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
PPTX
Reproducible Science with Python
PPTX
Python at Warp Speed
PPTX
A Provenance Model for Quantified Self Data
PPTX
Open Source im DLR
PDF
Tracking after Stroke: Doctors, Dogs and All The Rest
PPTX
High Throughput Processing of Space Debris Data
PDF
Bericht von der QS15 Conference & Exposition
PPTX
Telemedizin: Gesundheit, messbar für jedermann
PDF
Big Python
PDF
Quantified Self mit Wearable Devices und Smartphone-Sensoren
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Visualization of Software Architectures in Virtual Reality and Augmented Reality
Provenance as a building block for an open science infrastructure
Raising Awareness about Open Source Licensing at the German Aerospace Center
Open Source Licensing for Rocket Scientists
Interactive Visualization of Software Components with Virtual Reality Headsets
Provenance for Reproducible Data Science
Visualizing Provenance using Comics
Quantified Self Comics
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Reproducible Science with Python
Python at Warp Speed
A Provenance Model for Quantified Self Data
Open Source im DLR
Tracking after Stroke: Doctors, Dogs and All The Rest
High Throughput Processing of Space Debris Data
Bericht von der QS15 Conference & Exposition
Telemedizin: Gesundheit, messbar für jedermann
Big Python
Quantified Self mit Wearable Devices und Smartphone-Sensoren
Ad

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Electronic commerce courselecture one. Pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Modernizing your data center with Dell and AMD
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Big Data Technologies - Introduction.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Review of recent advances in non-invasive hemoglobin estimation
Reach Out and Touch Someone: Haptics and Empathic Computing
Electronic commerce courselecture one. Pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Understanding_Digital_Forensics_Presentation.pptx
Modernizing your data center with Dell and AMD
Advanced methodologies resolving dimensionality complications for autism neur...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Big Data Technologies - Introduction.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Machine learning based COVID-19 study performance prediction
Diabetes mellitus diagnosis method based random forest with bat algorithm
Review of recent advances in non-invasive hemoglobin estimation

Mixing Python and Java

  • 1. Mixing Python and Java How Python and Java can communicate and work together EuroPython 2009 (June 30th 2009, Birmingham) Andreas Schreiber <Andreas.Schreiber@dlr.de> German Aerospace Center (DLR), Cologne, Germany http://www.dlr.de/sc
  • 2. Final Version of this Slides is available on SlideShare http://tr.im/ep09java
  • 3. Summary Java is being used for many existing applications in a variety of domains. Sometimes it is useful to integrate them with Python. For instance, one may wish to add embedded Python scripting to Java applications, to communicate with separate Python code written for CPython, or use existing Java libraries from Python code. The talk gives an overview of the various techniques, tools, and libraries for bridging Python and Java. In particular, the following implementations are described and compared: * Embedding of Python into Java with Jython. * Calling Java code from CPython scripts with JPype. * Calling CPython from Java code with JEPP. * Using inter process communication between Python and Java (e.g., with CORBA or SPIRO). Examples for all techniques are demonstrated, and use cases for the different approaches are presented with examples from real world applications.
  • 4. Jython Java Virtual Machine Jython Python Code Java Application Code
  • 5. JEPP Python Interpreter Java Virtual Machine Java Application Code Python Code JNI JEPP
  • 6. JPype Python Interpreter JNI JPype Python Application Code Java Virtual Machine Java Application Code
  • 7. JCC Python Interpreter JNI Python Code Java Virtual Machine Java Application Code pythonExtension() Generated C++ Wrapper Code JCC Code Generator
  • 8. ORBs Java Virtual Machine Generated Java Code ( Stub ) Python Interpreter ORB Python Application Code ( Server ) Generated Python Code ( Skeleton ) Java Application Code ( Client ) IDL Compiler IDL
  • 9. Web Services: SOAP Java Virtual Machine Servlet Container Java Application Code ( Server ) Python Interpreter Generated Python Code ( Stub ) Python Application Code ( Client ) Generated Java Code ( Skeleton ) WSDL Compiler WSDL

Editor's Notes

  • #3: http://tr.im/ep09twt