A simple method to package Python code into jar software.
Py writes fast
However, java has a wide Ecosystem
For example, although big data py is good, it cannot use java's entire ecological code.
Scala is good, but after all, some libraries need to write more on their own.
Although it is also very simple, it is very troublesome to query documents.
So the question is
The simplest way is to directly package The py jar
The problem is that py is packaged into java, which is difficult to understand in official documents.
The answer is correct.
Wrote a pack of https://github.com/yishenggudou/jythontools
Do this
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$
The overall code is as follows:
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