Appendix B. Jython Options and Registry

This appendix covers the options you can use when invoking jython or jythonc from the command line. In addition, it covers the Jython registry, which is where Jython looks for system-specific values such as the path for Python modules.

Jython Options

The actual jython file on your system is a very short batch or shell script. All it does is start your Java Virtual Machine (JVM), set the Java python.home property, and call the main( ) function of the org.python.util.jython main interpreter class.

The basic structure of a call to jython is zero or more flags, followed by an optional source argument. If there is a source argument, any number of optional program arguments can follow it. Any program arguments are passed to the source in the sys.argv array (as is typical among command-line arguments, the first element in the array sys.argv[0] is the path of the source itself).

jython [options] [source] [args]

The command-line options are as follows:

-Dprop=value

Sets a Jython property value prop to value. Overrides any registry value for that property.

-i

Runs the source script, then invokes the interpreter to allow inspection of the state after the script runs.

-E codec

Sets codec for reading characters from the console.

-S

By default, Jython imports a module named site.py on startup if it exists. Using this flag suppresses that default.

--help

Prints a help message and exits.

--version

Prints a version message and exits.

The source options are as follows. If no ...

Get Jython Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.