SlideShare uma empresa Scribd logo
1 de 10
NADAR SARASWATHI COLLEGE
OF ARTS & SCIENCE
INTEGRATING JAVA WITH
PYTHON
DEPARTMENT OF COMPUTER SCIENCE
PRESENTED BY B.ARCHANA
I- M SC (CS)
INTEGRATE JAVA WITH PYTHON
•
• THE SEAMLESS INTERACTION BETWEEN PYTHON AND JAVA ALLOWS
DEVELOPERS TO FREELY MIX THE TWO LANGUAGES BOTH DURING
DEVELOPMENT AND IN SHIPPING PRODUCTS
HOW TO USE JAVA WITH PYTHON
•
• JYTHON IS THE JAVA PLATFORM IMPLEMENTATION OF PYTHON
WHICH RUNS ON THE JVM. ASSUMING THAT WE HAVE JYTHON ON
THE CLASSPATH, THE FRAMEWORK SHOULD AUTOMATICALLY
DISCOVER THAT WE HAVE THE POSSIBILITY OF USING THIS
SCRIPTING ENGINE AND ENABLE US TO ASK FOR THE PYTHON
SCRIPT ENGINE DIRECTLY.
COMMUNICATE BETWEEN JAVA AND PYTHON
• THE COMMUNICATION IS ONE DIRECTION: FROM PYTHON APP TO JAVA APP.
EVERY MESSAGE IS ONE LINE OF TEXT (ULTIMATELY: JSON FORMAT). E.G.:
“TEXTRN”. TO CLOSE COMMUNICATION, WE SEND MESSAGE: “XRN”
A SIMPLE PYTHON SCRIPT
• THROUGHOUT THIS TUTORIAL, WE’LL USE A VERY SIMPLE PYTHON SCRIPT
WHICH WE’LL DEFINE IN A DEDICATED FILE CALLED HELLO.PY;
• PRINT(“HELLO BAELDUNG READERS!!”)
python hello.py Hello Baeldung Readers!!
•
•
• FROM PY4J.JAVA_GATEWAY IMPORT JAVAGATEWAY
•
• GATEWAY = JAVAGATEWAY()
•
• MSGOBJECTFROMJAVAAPP = GATEWAY.ENTRY_POINT
• PRINT(MSGOBJECTFROMJAVAAPP.MESSAGE())
BEST USE JAVA AND JPYTHON TOGETHER
• JYTHON – PYTHON IMPLEMENTED IN JAVA
• JPYPE – ALLOWS PYTHON TO RUN JAVA COMMANDS
• JEPP – JAVA EMBEDDED PYTHON
• JCC – A C++ CODE GENERATOR FOR CALLING JAVA FROM C++/PYTHON
• JAVABRIDGE – A PACKAGE FOR RUNNING AND INTERACTING WITH THE JVM FROM
CPYTHON
• PY4J – ALLOWS PYTHON TO RUN JAVA COMMANDS.
• VOC – PART OF BEEWARE SUITE. CONVERTS PYTHON CODE TO JAVA BYTECODE.
• P2J – CONVERTS PYTHON CODE TO JAVA. NO LONGER DEVELOPED.
HOW TO RUN PYTHON SCRIPT WITH
ARGUMENTS FROM JAVA
•
• YOU CAN USE JAVA RUNTIME. EXEC() TO RUN PYTHON SCRIPT, AS AN EXAMPLE
FIRST CREATE A PYTHON SCRIPT FILE USING SHEBANG AND THEN SET IT
EXECUTABLE.
PASS COMMAND LINE ARGUMENTS IN ECLIPSE
• STEP 1: OPEN THE CLASS RUN CONFIGURATIONS SETTINGS. FROM THE CLASS
EDITOR, RIGHT CLICK AND CHOSE “RUN AS” -> “RUN CONFIGURATIONS…”. …
• STEP 2: SPECIFY THE PROGRAM ARGUMENTS IN THE ARGUMENTS TAB. IN THE
POP UP WINDOW, CLICK ON THE ARGUMENTS TAB. …
• STEP 3: CLICK ON THE RUN BUTTON.
THANK YOU

Mais conteúdo relacionado

Semelhante a Integrate Java and Python for app development

Communication between Java and Python
Communication between Java and PythonCommunication between Java and Python
Communication between Java and PythonAndreas Schreiber
 
Lagergren jvmls-2014-final
Lagergren jvmls-2014-finalLagergren jvmls-2014-final
Lagergren jvmls-2014-finalMarcus Lagergren
 
How to NLProc from .NET
How to NLProc from .NETHow to NLProc from .NET
How to NLProc from .NETSergey Tihon
 
A Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVMA Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVMBRNSSPublicationHubI
 
Java basic-tutorial for beginners
Java basic-tutorial for beginners Java basic-tutorial for beginners
Java basic-tutorial for beginners Muzammil Ali
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)Sujit Majety
 
66781291 java-lab-manual
66781291 java-lab-manual66781291 java-lab-manual
66781291 java-lab-manualLaura Popovici
 
The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015Christian Heilmann
 
Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17Vinay Kumar
 
Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvmhome
 
Advance java prasentation
Advance java prasentationAdvance java prasentation
Advance java prasentationdhananajay95
 
Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.Ritesh Kumar Bhanu
 

Semelhante a Integrate Java and Python for app development (20)

Communication between Java and Python
Communication between Java and PythonCommunication between Java and Python
Communication between Java and Python
 
Lagergren jvmls-2014-final
Lagergren jvmls-2014-finalLagergren jvmls-2014-final
Lagergren jvmls-2014-final
 
Bn1005 demo ppt core java
Bn1005 demo ppt core javaBn1005 demo ppt core java
Bn1005 demo ppt core java
 
How to NLProc from .NET
How to NLProc from .NETHow to NLProc from .NET
How to NLProc from .NET
 
A Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVMA Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVM
 
Java basic-tutorial for beginners
Java basic-tutorial for beginners Java basic-tutorial for beginners
Java basic-tutorial for beginners
 
slides-students-C03.pdf
slides-students-C03.pdfslides-students-C03.pdf
slides-students-C03.pdf
 
Introduction to java (revised)
Introduction to java (revised)Introduction to java (revised)
Introduction to java (revised)
 
66781291 java-lab-manual
66781291 java-lab-manual66781291 java-lab-manual
66781291 java-lab-manual
 
The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015
 
Mixing Python and Java
Mixing Python and JavaMixing Python and Java
Mixing Python and Java
 
Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17Modern application development with oracle cloud sangam17
Modern application development with oracle cloud sangam17
 
Architecture diagram of jvm
Architecture diagram of jvmArchitecture diagram of jvm
Architecture diagram of jvm
 
OOPC_Unit-I.pdf
OOPC_Unit-I.pdfOOPC_Unit-I.pdf
OOPC_Unit-I.pdf
 
Advance java prasentation
Advance java prasentationAdvance java prasentation
Advance java prasentation
 
Project Zero JavaOne 2008
Project Zero JavaOne 2008Project Zero JavaOne 2008
Project Zero JavaOne 2008
 
Java lab-manual
Java lab-manualJava lab-manual
Java lab-manual
 
java
javajava
java
 
Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.
 
Java
JavaJava
Java
 

Mais de archanab47

BASCI DATABASE.pptx
BASCI DATABASE.pptxBASCI DATABASE.pptx
BASCI DATABASE.pptxarchanab47
 
NADAR SARASWATHI COEGE OF ARTS AND SCIENCE CD.pptx
NADAR SARASWATHI COEGE OF ARTS AND SCIENCE CD.pptxNADAR SARASWATHI COEGE OF ARTS AND SCIENCE CD.pptx
NADAR SARASWATHI COEGE OF ARTS AND SCIENCE CD.pptxarchanab47
 
All pairs shortest paths
All pairs shortest pathsAll pairs shortest paths
All pairs shortest pathsarchanab47
 
servelt architecture.pptx
servelt architecture.pptxservelt architecture.pptx
servelt architecture.pptxarchanab47
 

Mais de archanab47 (10)

IOT
IOTIOT
IOT
 
ai.pptx
ai.pptxai.pptx
ai.pptx
 
dip.pptx
dip.pptxdip.pptx
dip.pptx
 
cc.pptx
cc.pptxcc.pptx
cc.pptx
 
we.pptx
we.pptxwe.pptx
we.pptx
 
we.pptx
we.pptxwe.pptx
we.pptx
 
BASCI DATABASE.pptx
BASCI DATABASE.pptxBASCI DATABASE.pptx
BASCI DATABASE.pptx
 
NADAR SARASWATHI COEGE OF ARTS AND SCIENCE CD.pptx
NADAR SARASWATHI COEGE OF ARTS AND SCIENCE CD.pptxNADAR SARASWATHI COEGE OF ARTS AND SCIENCE CD.pptx
NADAR SARASWATHI COEGE OF ARTS AND SCIENCE CD.pptx
 
All pairs shortest paths
All pairs shortest pathsAll pairs shortest paths
All pairs shortest paths
 
servelt architecture.pptx
servelt architecture.pptxservelt architecture.pptx
servelt architecture.pptx
 

Último

Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsSumit Kumar yadav
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)PraveenaKalaiselvan1
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bSérgio Sacani
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPirithiRaju
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real timeSatoshi NAKAHIRA
 
A relative description on Sonoporation.pdf
A relative description on Sonoporation.pdfA relative description on Sonoporation.pdf
A relative description on Sonoporation.pdfnehabiju2046
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfSumit Kumar yadav
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...ssifa0344
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsAArockiyaNisha
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptxRajatChauhan518211
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhousejana861314
 
Artificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C PArtificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C PPRINCE C P
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 sciencefloriejanemacaya1
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...Sérgio Sacani
 

Último (20)

Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questions
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real time
 
A relative description on Sonoporation.pdf
A relative description on Sonoporation.pdfA relative description on Sonoporation.pdf
A relative description on Sonoporation.pdf
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdf
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
 
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based Nanomaterials
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptx
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhouse
 
Artificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C PArtificial Intelligence In Microbiology by Dr. Prince C P
Artificial Intelligence In Microbiology by Dr. Prince C P
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 science
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
 

Integrate Java and Python for app development

  • 1. NADAR SARASWATHI COLLEGE OF ARTS & SCIENCE INTEGRATING JAVA WITH PYTHON DEPARTMENT OF COMPUTER SCIENCE PRESENTED BY B.ARCHANA I- M SC (CS)
  • 2. INTEGRATE JAVA WITH PYTHON • • THE SEAMLESS INTERACTION BETWEEN PYTHON AND JAVA ALLOWS DEVELOPERS TO FREELY MIX THE TWO LANGUAGES BOTH DURING DEVELOPMENT AND IN SHIPPING PRODUCTS
  • 3. HOW TO USE JAVA WITH PYTHON • • JYTHON IS THE JAVA PLATFORM IMPLEMENTATION OF PYTHON WHICH RUNS ON THE JVM. ASSUMING THAT WE HAVE JYTHON ON THE CLASSPATH, THE FRAMEWORK SHOULD AUTOMATICALLY DISCOVER THAT WE HAVE THE POSSIBILITY OF USING THIS SCRIPTING ENGINE AND ENABLE US TO ASK FOR THE PYTHON SCRIPT ENGINE DIRECTLY.
  • 4. COMMUNICATE BETWEEN JAVA AND PYTHON • THE COMMUNICATION IS ONE DIRECTION: FROM PYTHON APP TO JAVA APP. EVERY MESSAGE IS ONE LINE OF TEXT (ULTIMATELY: JSON FORMAT). E.G.: “TEXTRN”. TO CLOSE COMMUNICATION, WE SEND MESSAGE: “XRN”
  • 5. A SIMPLE PYTHON SCRIPT • THROUGHOUT THIS TUTORIAL, WE’LL USE A VERY SIMPLE PYTHON SCRIPT WHICH WE’LL DEFINE IN A DEDICATED FILE CALLED HELLO.PY; • PRINT(“HELLO BAELDUNG READERS!!”) python hello.py Hello Baeldung Readers!!
  • 6. • • • FROM PY4J.JAVA_GATEWAY IMPORT JAVAGATEWAY • • GATEWAY = JAVAGATEWAY() • • MSGOBJECTFROMJAVAAPP = GATEWAY.ENTRY_POINT • PRINT(MSGOBJECTFROMJAVAAPP.MESSAGE())
  • 7. BEST USE JAVA AND JPYTHON TOGETHER • JYTHON – PYTHON IMPLEMENTED IN JAVA • JPYPE – ALLOWS PYTHON TO RUN JAVA COMMANDS • JEPP – JAVA EMBEDDED PYTHON • JCC – A C++ CODE GENERATOR FOR CALLING JAVA FROM C++/PYTHON • JAVABRIDGE – A PACKAGE FOR RUNNING AND INTERACTING WITH THE JVM FROM CPYTHON • PY4J – ALLOWS PYTHON TO RUN JAVA COMMANDS. • VOC – PART OF BEEWARE SUITE. CONVERTS PYTHON CODE TO JAVA BYTECODE. • P2J – CONVERTS PYTHON CODE TO JAVA. NO LONGER DEVELOPED.
  • 8. HOW TO RUN PYTHON SCRIPT WITH ARGUMENTS FROM JAVA • • YOU CAN USE JAVA RUNTIME. EXEC() TO RUN PYTHON SCRIPT, AS AN EXAMPLE FIRST CREATE A PYTHON SCRIPT FILE USING SHEBANG AND THEN SET IT EXECUTABLE.
  • 9. PASS COMMAND LINE ARGUMENTS IN ECLIPSE • STEP 1: OPEN THE CLASS RUN CONFIGURATIONS SETTINGS. FROM THE CLASS EDITOR, RIGHT CLICK AND CHOSE “RUN AS” -> “RUN CONFIGURATIONS…”. … • STEP 2: SPECIFY THE PROGRAM ARGUMENTS IN THE ARGUMENTS TAB. IN THE POP UP WINDOW, CLICK ON THE ARGUMENTS TAB. … • STEP 3: CLICK ON THE RUN BUTTON.