Does jython depend on java class.

Ype Kingma ykingma at accessforall.nl
Fri Jul 30 08:18:56 EDT 2004


angel wrote:

> Thank you for your reply.
> 
> But I still want to confirm if jython requires standard java class, for
> example java.lang.* java.util.* ...
> From the word "the python dictionary type is implemented by the java
> classes org.python.core.PyStringMap and org.python.core.PyDictionary" , I
> guess jython should depend on java.lang.String, java.util.Hashtable ...
> 
> So jython doesn't only compile python source code to java bytecode, it is
> implemented by java language. Is it correct?

Yes. Jython dynamically compiles Python modules to java classes, and
Jython's Python interpreter is written in Java. The classes
of the compiled modules closely cooperate with this interpreter,
much like CPython.

The implementation of the Jython interpreter relies on the Java standard
library (java.lang.*, java.util.*) as any other Java program.

OTOH, Jython also provides any Java package on the class path
as a Python package, and one can eg. implement a Java interface by
subclassing in Python.

Kind regards,
Ype


> 
> Thanx
> 
> "Alan Kennedy" <alanmk at hotmail.com>
> ??????:KM7Oc.5748$Z14.6872 at news.indigo.ie...
>> [angel]
>> > A java runtime environment includes jvm and java class (for example
>> > classes.zip in sun jre). Of course jython need jvm,but does it need
java
>> > class.
>>
>> Yes, jython requires specific classes at runtime.
>>
>> For example, the python dictionary type is implemented by the java
>> classes org.python.core.PyStringMap and org.python.core.PyDictionary.
>> The .class files for these classes are stored in jython.jar, which
>> always has to be loadable/in-your-classpath when your java application
>> uses jython.
>>
>> Jython also includes its own specialised classloader, due to the
>> highly dynamic nature of jython class construction, which can cause
>> problems in certain security-conscious environments. This classloader
>> can be bypassed by compiling jython classes to java with jythonc. But
>> even with jythonc-generated java classes the dependency on jython.jar
>> remains, because of the need for access to the definitions of
>> org.python.core.PyDictionary, etc.
>>
>> HTH,
>>
>> --
>> alan kennedy
>> ------------------------------------------------------
>> check http headers here: http://xhaus.com/headers
>> email alan:              http://xhaus.com/contact/alan

-- 
email at xs4all.nl



More information about the Python-list mailing list