how can we run python script(which uses nltk and scrapy) from java

冷暖自知 提交于 2019-12-10 19:18:56

问题


I have written python scripts that use scrapy,nltk and simplejson in my project but i need to run them from java as my mentor wants to deploy them on a server and i have very less time to do this.I took a glance at runtime.exec() in java and jython, needless to say that running system commands from java doesn't look simple either.

So I would like to know if running the python scripts from java as system command -'python example.py ' using runtime.exec() or alternatively using jython would be more simpler and actually feasible or whether there is a simpler workaround .It would also be great to know if anyone had run python code that uses nltk from java using Jython and whether they encountered any problems.Please help me as I have to do this as asap.Any thoughts and suggestions regarding this are welcome.

Thanking in advance!!


回答1:


The Jepp project lets you call python scripts from Java. It provides an easy mechanism to pass variables into a script and extract values back. I've used on a few projects with good success



来源:https://stackoverflow.com/questions/3234965/how-can-we-run-python-scriptwhich-uses-nltk-and-scrapy-from-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!