Calling Java Code from CPython (1.5.2 or 2.0)
Keith Ray
k1e2i3t4h5r6a7y at 1m2a3c4.5c6o7m
Tue Jan 16 23:04:46 EST 2001
In article <93mdfs$g7q$1 at nyheter.chalmers.se>, "Dario Lopez-Kästen"
<dario at _no_spam_.ita.chalmers.se> wrote:
> Hello!
>
> <newbie class="clueless">
>
> I would like to know if it is possible to call Java Code from CPython (as
> in
> not Jython or JPython). I am asking this, because i'd like to be able to
> experiment using JDBC in conjunction with python; specifically, I want to
> use Zope and JDBC drivers on Solaris/Linux and that "other" operating
> system
> to connect to Oracle, MIMER and some other DBMSs we have.
[...]
I suppose one could wrap the JNI functions with CPython module...
I could also imagine a CPython module using JNI functions and Java
reflection to do a more general-purpose bridge for python. Create python
objects that are bridges to java objects. Forwarding python method calls
to the java objects, converting basic CPython types into Java
equivalents for argument passing...
Then to be able to pass python objects into java methods, you'd want the
bridge to also go the other way, this is a little fuzzier in my
imagination... perhaps by using instances of a java wrapper object that
makes calls via JNI to the Python reflection API...?
Making inheritance work on both sides seems like the real kicker...
might require generating java and source code and compiling it.
I bet it wouldn't take more than 2 or 3 person-years (for someone more
motivated than I) to complete. :-)
I would be interested to know if someone has already done this.
--
<http://homepage.mac.com/keithray/resume.html>
More information about the Python-list
mailing list