Two Jython Questions

Mats Wichmann mats at laplaza.org
Wed Aug 29 23:07:52 EDT 2001


On Wed, 29 Aug 2001 15:12:08 -0500, "Maan M. Hamze"
<mmhamze at pleiades.net> wrote:

:I just got into Jython.  I installed version 2.  After trying it out, I
:wanted to import Java classes.  But I noticed that it will not import from
:jar or zip files of java classes.  In other words, I had to unzip (unjar)
:the classes into a directory where Jython can find it.
:1.  Is there a way to make Jython import classes directly from archives
:(zip. jar)?  Or is this not supported.

The CLASSPATH must include the jar file itself, not just the directory
it's in.  Take a look at the Jython script itself and you'll see
that's what it does (it will be jython.bat on WIndoze, a shell script
on UNIX/Linux).

:2.  Can Jython save a py script into a java file or is the py script
:compiled directly into a .class file?

If you want to build classfiles you can do so with jythonc. That's the
analogue to javac, except it's Python->java bytecode instead of Java->
java bytecode.  There's no translation to java /source/.

:All in all I am impressed - this program can spoil someone into not writing
:a code of Java ever again.
:Thanks,
:Maan
:
:

Mats Wichmann




More information about the Python-list mailing list