473,230 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

Does jython depend on java class.

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.

Thanx
Jul 18 '05 #1
4 3379
[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
Jul 18 '05 #2
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?

Thanx

"Alan Kennedy" <al****@hotmail.com>
??????:KM*****************@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

Jul 18 '05 #3
[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.

[Alan Kennedy]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.

[angel] 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 does require java classes, e.g. java.util.*, java.lang.*,
etc, at runtime.

Attempting to summarise:-

1. Jython compiles all jython classes to java bytecode.

2. The java bytecode generated is layered upon a jython-specific
"runtime" which implements jython semantics for data types: i.e.
org.python.core.*

3. The classes in this jython specific runtime depend on java platform
classes, i.e. java.util.*, java.io.*, etc.

This can be seen by looking at the source for jython, i.e.

$jython_home/org/python/core/*.java

where you will see the jython "runtime" files containing import
statements of the form

import java.io.*;
import java.util.*;
import java.lang.ref.*;

For example, the import list for org.python.core.PyList.java is

import java.util.Vector;

which shows that jython lists are built on java.util.Vector objects,
the definition of which obviously must be available when jython
programs use lists. This is true both when the code is compiled
dynamically by jython, and when it is compiled statically by jythonc.

HTH,

--
alan kennedy
------------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan: http://xhaus.com/contact/alan
Jul 18 '05 #4
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" <al****@hotmail.com>
??????:KM*****************@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
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tennessee James Leeuwenburg | last post by:
Hi all, Sorry for the newb question, but Googling and FAQing didn't work. Is it correct that Jython can only access Java classes which are inside JAR archives in the JYTHON_HOME directory? IT...
4
by: Michael Chermside | last post by:
Ype writes: > For the namespaces in Jython this 'Python internal thread safety' > is handled by the Java class: > > http://www.jython.org/docs/javadoc/org/python/core/PyStringMap.html > > which...
6
by: Dave Benjamin | last post by:
Hey good people, I've been doing a lot of simultaneous Jython and CPython programming lately, and just wanted to say, with no intended ill will toward any of the individuals who have been...
7
by: Jan Gregor | last post by:
Hello I found that jython catches exact java exceptions, not their subclasses. Is there some way to get around this limitation (or error) ? My program has class representing database source...
12
by: Mark Fink | last post by:
I wrote a Jython class that inherits from a Java class and (thats the plan) overrides one method. Everything should stay the same. If I run this nothing happens whereas if I run the Java class it...
3
by: donkeyboy | last post by:
All, I'm having issues installing Jython on Windows XP. I've looked on the web and this newsgroup but to no avail. Any suggestions? The shell listing is below: NB I've got Cygwin installed,...
2
by: Matt Bitten | last post by:
Hi, all. I'm in a situation where I need to be writing a bunch of quick-y (hopefully) self-contained programs that anyone can run from a web page. Java applets are the obvious way to do this....
5
by: sarup26 | last post by:
Hello .. I would like to know more about Python and Jython? What is the difference between both of them? What is the future for Jython and which are the areas where it is used? Swot
1
by: kramer31 | last post by:
Hi. First, I'm not sure if this is the correct group, but becuase I couldn't find a jython newsgroup, I'll post here. I'm new to jython and am just trying to get it to work. Interpreted jython...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.