V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
feihu
V2EX  ›  Python

有人在实际开发环境中使用python调用java的lib吗?请给点建议

  •  
  •   feihu · 2013-05-02 17:43:38 +08:00 · 6198 次点击
    这是一个创建于 3983 天前的主题,其中的信息可能已经有所发展或是发生改变。
    10 条回复    1970-01-01 08:00:00 +08:00
    tkliuxing
        1
    tkliuxing  
       2013-05-02 19:27:35 +08:00
    请使用jython
    Muninn
        2
    Muninn  
       2013-05-02 20:49:04 +08:00
    见楼上 而且何苦呢~
    python的lib很齐全的呀其实
    除非是要调用以前自己写的
    可是重写一遍顺便重构这种事情不是很爽么。。。
    jjx
        3
    jjx  
       2013-05-02 21:25:30 +08:00
    dreampuf
        4
    dreampuf  
       2013-05-02 23:00:50 +08:00
    不推荐,使用JPype封装了Apache POI,写用JAVA API写Python Code
    推荐Groovy或者Jython,封装为jar后命令行调用吧。
    kshatriya
        5
    kshatriya  
       2013-05-03 00:07:34 +08:00
    java? Clojure
    mrluanma
        6
    mrluanma  
       2013-05-03 01:31:51 +08:00
    用Python的C-API通过JNI调用Java API,Java的著名程序Lucene的Python封装PyLucene就是用的这个思路。

    它们的代码生成器叫做JCC:http://lucene.apache.org/pylucene/jcc/
    ygtq
        7
    ygtq  
       2013-05-03 13:03:18 +08:00
    lz,你和我的头像一样!!
    jamiesun
        8
    jamiesun  
       2013-05-04 15:13:24 +08:00
    大多数情况下直接命令行调用jar完全够了。
    feihu
        9
    feihu  
    OP
       2013-05-04 19:43:10 +08:00
    @jamiesun 直接命令行会不会很占内存?我只有一台小机器。怕带不动
    @tkliuxing jython有成功的案例吗?
    jamiesun
        10
    jamiesun  
       2013-05-04 23:09:20 +08:00
    @feihu 主要还是看你应用在什么场景了,如果只是个人应用,没什么担忧的,顶多在调用java时增加一些内存限制,不至于把系统搞死。

    若是网络应用,基于socket消息通讯机制来做更好,比如使用thrift。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5859 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 02:25 · PVG 10:25 · LAX 19:25 · JFK 22:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.