jpython and java apps

Dave dave at see.sig.for.address
Sun Sep 5 17:03:29 EDT 1999


On Sat, 4 Sep 1999 21:35:36 -0400, "Richard Hensh"
<hensh at math.msu.edu> wrote:

>Can one "compile" a Python script into a Java class (?) using JPython (a la
>NetRexx)?
>
>thanks
>ricky
>

Yes, though it is not very well documented. 

Essentially you have to do the following:

1) write a python class and have it inherit from a Java class or
interface. The python class must have the same name as the file it is
in, just like Java classes. 

2) add a doc string to each python method that specifies the Java
signature, starting with "@sig". This bit is not documented, but is
done in the example that comes with jpython. 

3) compile the python class using jpythonc. This will create the
.class files that can be used just like any other Java class. There
are numerous options to jpythonc for things like creating jar files
and packages, which are documented to some extent.

Make sure you have the latest version of jpython (1.1a2), especially
if you want to use Java packages.  I would also suggest joining the
jpython mailing list, which is where all the real experts hang out.

	Dave K
--------------------------------------------------
All great ideas start as heresy and end as dogma.

dkirby@   <-figure this out, spambots!
bigfoot.   My opinions are my own,
com        but I'm willing to share.




More information about the Python-list mailing list