Python script to .jar file using Py4J

838 views
Skip to first unread message

Abdul Motin HOWLADER

unread,
Jul 9, 2019, 7:57:40 PM7/9/19
to Py4J Support and Comments
Dear All,

Let say, I have a simple python script like:
-----------------------------------
class abc:
    def __init__(self):
       pass
    def sum(self, d, f):
       self.a=10
       print(self.a)
    def mean(self):
        print(self.a)    
if __name__ == '__main__':
    g=abc()
    g.sum(90,4)
 -----------------------------------------
 May I able to generate executable .jar file if I convert this code using Py4J. Actually I am searching python script (3.6) to .jar converter. If there are any other options, please refer to me.

Thank you so much.

Motin

J. Hwan Park

unread,
Jul 9, 2019, 9:59:23 PM7/9/19
to Py4J Support and Comments
Hello, Motin.

It's an interesting topic. Although the title of the official Py4J site is 'A Bridge between Python and Java', as I know that using Py4J is for calling Java-side in Python-side.
In fact, the description of the official site is also as follows. - 'Py4J enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine.'

This case is the opposite - I think it's the case that you are calling Python-side from Java-side. How about referring the below link?

Please let me know if I know wrong.

Junghwan.
Reply all
Reply to author
Forward
0 new messages