Can I link a Java library using Jython with my code in Python
Question: I need to use the library Jena which is in Java in my code that is written in
Python. Now, I want to know if Jython can bridge between these two or not!!!
according to [this
thread](http://stackoverflow.com/questions/9727398/invoking-jython-from-
python-or-vice-versa) Jython can be invoked in a python code. but I need to
access the functions in Jena and get back the answers into my python code. I
am speculating that the code should look like below. the main part is the
importing a java library, running the desired function and getting the results
back.

    
    
    import execnet
    gw = execnet.makegateway("popen//python=jython", var1, var2)
    channel = gw.remote_exec("""
    import Jena #it is a java library.
    reason(var1, var2)
    ...
    """)
    fun(channel)
    


Answer: Yes, in principal you can take your existing Python code, import some Java
libs into it, and then run it under Jython and it will work. That said, not
all Python packages will work under Jython for various reasons, often due to C
extensions or other differences in the implementation of the Jython
interpreter from regular CPython.

