Using python code from Java?

Discussion in 'Python' started by fortepianissimo, Jul 20, 2006.

  1. Is there a solution to enable Java programmers to call functions
    written in Python? Any wrapper generator that wraps Python code into
    some Java-callable form?

    I briefly looked at Jython, but if I understand it right, it didn't
    support full power of Python 2.3.x (which I need).

    Any suggestion is welcome!
    fortepianissimo, Jul 20, 2006
    #1
    1. Advertising

  2. fortepianissimo schrieb:
    > Is there a solution to enable Java programmers to call functions
    > written in Python? Any wrapper generator that wraps Python code into
    > some Java-callable form?
    >
    > I briefly looked at Jython, but if I understand it right, it didn't
    > support full power of Python 2.3.x (which I need).
    >
    > Any suggestion is welcome!


    CORBA or any other RPC mechanism supported by both python & Java springs
    to mind.

    Waiting for jython2.3 might be an option, too - things are pretty much
    on the move right now.

    Diez
    Diez B. Roggisch, Jul 20, 2006
    #2
    1. Advertising

  3. Diez B. Roggisch wrote:
    > fortepianissimo schrieb:
    > > Is there a solution to enable Java programmers to call functions
    > > written in Python? Any wrapper generator that wraps Python code into
    > > some Java-callable form?
    > >
    > > I briefly looked at Jython, but if I understand it right, it didn't
    > > support full power of Python 2.3.x (which I need).
    > >
    > > Any suggestion is welcome!

    >
    > CORBA or any other RPC mechanism supported by both python & Java springs
    > to mind.


    Thanks for the tip - but anything tighter than that? Dealing with
    multiple servers within one application is a bit too much for my
    project...

    > Waiting for jython2.3 might be an option, too - things are pretty much
    > on the move right now.


    Any idea how soon that will be?

    Thanks!
    fortepianissimo, Jul 20, 2006
    #3
  4. I can't think of any project that does that. Calling stuff from Java is
    not easy to beging with you have to go through the native interface
    (JNI) anyway.

    I would suggest instead to create some kind of a protocol and let the
    applications talk using an external channel (a FIFO pipe file, a socket
    or just any network connection.) Usually when you go back and forth
    between languages you don't really need a particular class object
    (because class objects are quite different between languages) but what
    you need is to have data passed back and forth and have both sides
    interpret the data and process it. This sort of sounds like a protocol
    and it is. Depending on how easy vs. extensible vs. comprehensible your
    project is you could of course use XML RPC but that could get
    complicated.

    If you have extra time and desire you can of course contribute and
    help bring Jython to 2.3, they can always use some help...

    Nick V.


    fortepianissimo wrote:
    > Is there a solution to enable Java programmers to call functions
    > written in Python? Any wrapper generator that wraps Python code into
    > some Java-callable form?
    >
    > I briefly looked at Jython, but if I understand it right, it didn't
    > support full power of Python 2.3.x (which I need).
    >
    > Any suggestion is welcome!
    Nick Vatamaniuc, Jul 20, 2006
    #4
  5. fortepianissimo

    Ray Guest

    fortepianissimo wrote:
    > > Waiting for jython2.3 might be an option, too - things are pretty much
    > > on the move right now.

    >
    > Any idea how soon that will be?


    If you just want to use Java to call Python, you can use Jython 2.1
    too. Jython 2.2 is in (active) development right now, and hopefully a
    beta will come out soon.



    >
    > Thanks!
    Ray, Jul 21, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=

    Fire Code behind code AND Javascript code associated to a Button Click Event

    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    21,176
    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=
    Feb 11, 2004
  2. juraj
    Replies:
    1
    Views:
    622
    Andrew Thompson
    Mar 2, 2007
  3. Python Maniac
    Replies:
    24
    Views:
    756
    Matt McCredie
    Sep 23, 2007
  4. Royan
    Replies:
    8
    Views:
    737
    Patricia Shanahan
    Feb 15, 2008
  5. Replies:
    3
    Views:
    1,464
    Gabriel Genellina
    Jun 18, 2008
Loading...

Share This Page