py 写东西快
但是java 生态广
比如大数据 py 虽然好 但是利用不到java的整个的生态的代码
scala 虽然也好但是毕竟 有些库 需要自己写的多
虽然也很简单 ,但是查文档也很麻烦
那么 问题来了
最简单的的方式就是直接把py 打包 jar
那么 问题又来了 py 打包成java 挺麻烦的 官方文档看不懂
答案 有了
写了个 包 https://github.com/yishenggudou/jythontools
搞这个事情
timger-mac:test timger$ python ../jytool/jytoollib.py hellojython.py main timger-mac:test timger$ java -jar output.jython.jar *sys-package-mgr*: processing modified jar, '/users/timger/github/jythontools/jytool/test/output.jython.jar'hello jythontimger-mac:test timger$
整体代码如下
timger-mac:test timger$ java -jar output.jython.jar a a s s shello jython['a', 'a', 's', 's', 's']timger-mac:test timger$ cat hellojython.py#!/usr/bin/env python# -*- coding: utf-8 -*-## copyright 2011 timger# +author timger# +gtalk&email yishenggudou@gmail.com# +msn yishenggudou@msn.cn# +weibo @timger http://t.sina.com/zhanghaibo# +twitter @yishenggudou http://twitter.com/yishenggudou# licensed under the mit license, version 2.0 (the license);__author__ = 'timger'import sysdef main(): print hello jython print sys.argv