首页 > 编程语言 > 详细

java exec python program

时间:2019-05-22 00:59:57      阅读:94      评论:0      收藏:0      [点我收藏+]

 

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

原文:https://www.cnblogs.com/xu-xiaofeng/p/10903131.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!