A simple method to package Python code into jar software.

Source: Internet
Author: User

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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.