将Python代码打包为jar软件的简单方法
2015-08-04 12:09
2291 查看
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 jython timger-mac:test timger$
整体代码如下
timger-mac:test timger$ java -jar output.jython.jar a a s s s hello 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 sys def main(): print "hello jython" print sys.argv
您可能感兴趣的文章:
相关文章推荐
- Python动态类型的学习---引用的理解
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析
- Python在CAM软件Genesis2000中的应用
- 使用Shiboken为C++和Qt库创建Python绑定
- FREEBASIC 编译可被python调用的dll函数示例
- Python 七步捉虫法
- Python实现的基于ADB的Android远程工具