I find three methods, the first is using jython, the module of jython can transform the type of data between Python and java,so you can define the java data structure execution with Python interpreter, besides,Java receive appropriate type of data from Python interperter. but this method drawback is can`t import the third part package in python interperter.

The second is using java command line util which can start a new process to execute python program, this method very convinient,but not safe enough,because the process can`t be control when it started. If you not care about the security problem, I strongly recommend this method.

The third is most safety and complicated,some blog even mention it,but I think neccessary to let you know. The answer is RestApi, using web frame like flask for python,then you can start a webservice based on SSL and HTTPS,when using java code call the python RestApi, the CA certification is required.

java exec python program的更多相关文章

  1. Runtime.getRuntime().exec()实现Java调用python程序

    使用Runtime.getRuntime().exec()来实现Java调用python,调用代码如下所示: import java.io.BufferedReader; import java.io ...

  2. Java调用Python脚本

    今天遇到Java调用一个Python脚本的问题,纠结了大半天,遇到各种问题.网上搜索的大部分都是用jython,但是我想要调用的python脚本里有import urllib,这个urllib也不是什 ...

  3. Java调用Python相关问题:指定python环境、传入参数、返回结果

    本篇文章涉及到的操作均在Windows系统下进行,Java调用python在原理上不难,但是可能在实际应用中会有各种各样的需求,网上其他的资料很不全,所以又总结了这篇文章,以供参考. 一.指定pyth ...

  4. windows文本转语音 通过java 调用python 生成exe可执行文件一条龙

    我已记不清 我失败过多少次 ,找过多少资料 ,但是功夫不负有心人 ,还是成功了. 所有资料和需要的语音模块的资料以放置在文章末尾, 有些是引用别人的博客的部分内容, 原文是在有道云笔记,所以没有图,请 ...

  5. windows 下用eclipse搭建java、python开发环境

    本人只针对小白!本文只针对小白!本文只针对小白! 最近闲来无事,加上之前虽没有做过eclipse上java.python的开发工作,但一直想尝试一下.于是边查找资料边试验,花了一天时间在自己的机器上用 ...

  6. paip.执行shell cmd 命令uapi java php python总结

    paip.执行shell cmd 命令uapi java php python总结 作者Attilax  艾龙,  EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:h ...

  7. Java vs Python

    面试时常问到这两种语言的区别,在此总结一下. Referrence: Udemy:python-vs-java Generally, Python is much simpler to use, an ...

  8. Java 调用python说明文档

    Java 调用python说明文档 通过java调用python脚本主要如下三种方式: 1.直接执行python脚本: 2.执行python.py文件: 3.使用Runtime.getRuntime( ...

  9. java调用python程序以及向python程序传递参数

    在做项目的时候,经常会碰到这个问题,主要程序是用java写的,有些功能使用python写的,整个项目需要把java代码和python代码进行整合,在一个项目里面运行,这就涉及到java调用python ...

随机推荐

  1. JS用map做接口数据映射

    · 接口做数据映射的好处:前端页面自定义的字段不需要和后端字段相同,后端修改字段前端不受影响. · 从接口得到数据 res: let r = res.map(item => { return { ...

  2. Android布局管理器-使用LinearLayout实现简单的登录窗口布局

    场景 Android布局管理器-从实例入手学习相对布局管理器的使用: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/1038389 ...

  3. 如何在IDEA的maven项目中连接并使用MySQL8.0

    首先看一下我的基本的开发环境: 操作系统:MacOS 10.13.5 编辑器:IDEA 2018.3 其他:MySQL8.0.15.Maven 3.3.9.JDK 1.8 好,下面就正式开始: 第一步 ...

  4. [Python之路] bisect模块

    bisect模块 bisect是Python提供的二分查找模块 源码如下: """Bisection algorithms.""" def ...

  5. 简单配置让iterm2用得更爽

    同步自本人独立博客:https://liushiming.cn/2020/01/15/awesome-iterm2-config/ 概述 iterm2比mac原生的terminal好用很多,是mac下 ...

  6. Node.js核心模块-net

    net.Socket 类 socket.remotePort 访问服务器的远程端口 const http = require('http'); const server = http.createSe ...

  7. 一、threejs————灯光阴影

    threejs设置阴影有三个注意点 1.只有支持阴影的灯光才可以 pointLight,spotlight,directionallight 2.添加摄像机辅助器 THREE.CameraHelper ...

  8. ggEditor流程图增加网格背景

    参考官方文档: https://www.yuque.com/antv/g6/plugin.tool.grid react-ggEditor如何使用 import { Flow } from 'gg-e ...

  9. VS GIT 使用入门---我只是搬运工

    网上资料推荐 GitHub 新手详细教程 - Hanani_Jia的博客 - CSDN博客 https://blog.csdn.net/Hanani_Jia/article/details/77950 ...

  10. day 9 深浅拷贝

    浅copy 现有数据 data = { "name":"alex", "age":18, "scores":{ &quo ...