Use Jython to make true executable?

D-Man dsh8290 at rit.edu
Fri Jun 8 18:22:39 EDT 2001


On Fri, Jun 08, 2001 at 07:05:00PM +0000, Carl Fink wrote:
| I'm a Python beginner, so forgive me if this question is stupid.
| 
| A common request on this group is a true compiler to convert a Python
| script to a directly-executable program. (ELF for Linux, .exe for
| Windows/DOS, etc.)  

This request comes from people who don't know that having a .py file
(or .pyw) is just as good as having a .exe file.  In fact, having a
.py is better because it will work with newer (better) interpreters
and can be fixed if it has some problem.  The request comes more from
Windows users who don't want to tell people they need to install
python and who don't want to ship python with their program.  Linux
systems typically have python already, or it can simply be listed as a
dependency in the package (apt-get will automatically install it then,
if you are using Debian).

| Couldn't you develop your program in Jython, "compile" it to Java
| bytecodes, then run them through GCC?  I haven't tried it, but I've
| read that GCC can convert Java to direct executables.  

GCC (gcj, rather) can compile Java _source_ to native code (C++ object
files) that ld links together with libgcj (Sun's jdk calls it "rt.jar"
or in older versions "classes.zip") at runtime.

| Now, I also am far from a Java expert.  For instance, would Swing be
| convertible using GCC given that it's not free software?

If you have the source, then go right ahead.  I don't think libgcj
implements the AWT yet, though, and I know Kaffe doesn't (a free, open
source JVM).  OTOH there is PJA (Pure Java AWT) that can be used
instead (it is most useful for headless servlets, etc).

-D





More information about the Python-list mailing list