473,387 Members | 3,820 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,387 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 3394
[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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.