|
From: Robert W. B. <rb...@di...> - 2001-06-19 03:16:12
|
Hello Titus,
On Mon, 18 Jun 2001 ti...@ca... wrote:
> Hi all,
>
> I have a Jython package that I'd like to distribute in a single file,
> if possible. I see tantalizing references to "freezing" vs "compiling";
> it sounds like I want the former, since I rely fairly heavily on a
> non-Java file structure (e.g. more than one class/file), but I'm not
> sure what the options are here.
Current options:
1. runnable
2. frozen- seemingly likely option for your needs.
and maybe,
3. Custom import
> I'd be happy to explore the possibilities if someone can get me started
> on the right track, but I'd rather not trail-blaze if there's something
> already out there.
>
> I did see a particularly interesting reference to a "shallow freeze" in
> a 12-2000 post by Finn Bock, but there were no followups.
>
> thanks in advance,
> --titus
>
> P.S. It would be quite useful to receive a simple reply like "you'll have
> to figure it out on your own" so that I know I'm not wasting my time ;).
This isn't really trail-blazing. The jythonc docs are fairly helpful, and
are located at:
http://jython.sourceforge.net/docs/jythonc.html
The cliff-notes are:
Option 1. runnable-
A "runnable" Jython module is one compiled with jythonc without
tracking dependencies. This requires attention to paths to ensure
dependencies are located and loaded (by setting -Dpython.home, or by
explicitly appending to sys.path). If module A imports module B, you make
runnable classes with:
jythonc A.py
Option 2. frozen-
A "frozen" application is one compiled with the --deep option so that
dependancies are tracked. This sounds most useful to your situation
consider you say you are distributing an application (implies that it
doesn't require subsequent changes).
To freeze A.py use:
jythonc --deep -j myapp.jar A.py
This compiles A.py and B.py and places the compiled classes in myapp.jar.
This jar plus jython.jar (plus any other jars you use) is all that is
required to run your app.
You can be increasingly lazy and use the following:
jythonc --all -j myapp.jar A.py
This tracks dependencies and packages up core, parser, and compiler
goodies so everything you need is potentially within this jar (not
including external jars you depend on).
Option 3. Custom import
You'll have to figure it out on your own ;)
Maybe the path at this url helps with option 3:
http://www.jython.org/cgi-bin/moin.cgi/PoorManFreezing
Get back if I've misunderstood the question (again).
-robert
|