Differences between revisions 1 and 2
Revision 1 as of 2006-06-27 15:22:49
Size: 43
Editor: JoshJuneau
Comment:
Revision 2 as of 2006-07-07 05:14:48
Size: 2401
Editor: OtiHumbel
Comment: added standalone mode
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
''' Jython Monthly July 2006 Articles ''' = Jython Monthly July 2006 Articles =

== Standalone mode - Libraries included ==
Jython has now a standalone mode, where the core part is all included in one single `jython.jar` file. This has two advantages:
 * simpler starting: `java -jar jython.jar`
 * simpler embedding: just put `jython.jar` onto your classpath. No setting of `python.home` nor `python.path` required.
This really adds a Plug & Play feature to Jython.

There is a preview available ([http://homepage.sunrise.ch/mysunrise/ohumbel/jython_2837.jar snapshot build]).

A sample install and run session, after downloading `jython_2837.jar`:
{{{
[root@localhost downloads]# java -jar jython_2837.jar -s -d /tmp/jython_standalone -t standalone
Performing silent installation
 10 %
 20 %
 30 %
 40 %
 50 %
 60 %
 70 %
 80 %
Packing standalone jython.jar ...
 90 %
 100 %
Congratulations! You successfully installed Jython HEAD to directory /tmp/jython_standalone.

[root@localhost downloads]# cd /tmp/jython_standalone/
[root@localhost jython_standalone]# ls
jython.jar

[root@localhost jython_standalone]# java -jar jython.jar
*sys-package-mgr*: processing new jar, '/tmp/jython_standalone/jython.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/rt.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/jsse.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/jce.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/charsets.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/sunjce_provider.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/localedata.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/sunpkcs11.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/dnsns.jar'
Jython 2.2a1 on java1.5.0_07 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/tmp/jython_standalone/.', '/tmp/jython_standalone/./Lib', '/tmp/jython_standalone/jython.jar/Lib']
>>> import getopt
>>>
}}}

One Open issue: the cachedir problem still remains. If the directory containing `jython.jar` is not writable, no cachedir will help importing java classes. This is a well known problem also persistent in non-standalone mode. We try to improve this in standalone mode.

Jython Monthly July 2006 Articles

Standalone mode - Libraries included

Jython has now a standalone mode, where the core part is all included in one single jython.jar file. This has two advantages:

  • simpler starting: java -jar jython.jar

  • simpler embedding: just put jython.jar onto your classpath. No setting of python.home nor python.path required.

This really adds a Plug & Play feature to Jython.

There is a preview available ([http://homepage.sunrise.ch/mysunrise/ohumbel/jython_2837.jar snapshot build]).

A sample install and run session, after downloading jython_2837.jar:

[root@localhost downloads]# java -jar jython_2837.jar -s -d /tmp/jython_standalone -t standalone
Performing silent installation
 10 %
 20 %
 30 %
 40 %
 50 %
 60 %
 70 %
 80 %
Packing standalone jython.jar ...
 90 %
 100 %
Congratulations! You successfully installed Jython HEAD to directory /tmp/jython_standalone.

[root@localhost downloads]# cd /tmp/jython_standalone/
[root@localhost jython_standalone]# ls
jython.jar

[root@localhost jython_standalone]# java -jar jython.jar 
*sys-package-mgr*: processing new jar, '/tmp/jython_standalone/jython.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/rt.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/jsse.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/jce.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/charsets.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/sunjce_provider.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/localedata.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/sunpkcs11.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jre1.5.0_07/lib/ext/dnsns.jar'
Jython 2.2a1 on java1.5.0_07 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/tmp/jython_standalone/.', '/tmp/jython_standalone/./Lib', '/tmp/jython_standalone/jython.jar/Lib']
>>> import getopt
>>> 

One Open issue: the cachedir problem still remains. If the directory containing jython.jar is not writable, no cachedir will help importing java classes. This is a well known problem also persistent in non-standalone mode. We try to improve this in standalone mode.

JythonMonthly/Articles/July2006 (last edited 2008-11-15 09:16:03 by localhost)