Installation

Jython is distributed as a self-extracting .class file created by LiftOff. To install Jython, open the command line to the directory in which you have placed the jython-21.class file and then type:

<java interpreter> jython-21

You will probably type one of the following three lines, depending on your system. Be sure not to put ".class" at the end of the file name.

java jython-21

jre jython-21

jview jython-21

It can be necessay to set the CLASSPATH to include the current directory

env CLASSPATH=. java jython-21

java -cp . jython-21

java -classpath . jython-21

jview /cp:. jython-21

Which command to use depends on your operating system and java version. If you have more than one java installed, you may have to supply an explicit path the java command. When installing the JDK 1.2 from javasoft, the default is it install both the JDK and a plugin JRE. The plugin JRE is added to your PATH, so running the java jython-21 command will make jython use the JRE. Specify the full path if you want to use JDK instead, ie: c:\Programs\JDK1.2\bin\java -cp . jython-21.

If you do not have a GUI, then add -o dir_to_install_to to the command above. Jython will install to the specified directory without bringing up the graphical installer. E.g. to install all modules to a Jython-2.1 subdirectory in the current directory do:

<java interpreter> jython-21 -o Jython-2.1 demo lib source

After completing installation, you should be able to run Jython by typing:

jython

What Can Go Wrong

You should check out this section if your Jython installation doesn't quite work right. It will contain tips for solving the most common problems.

Can't Access Standard Python Modules

Not all the modules form CPython is available in Jython. Some modules require a C language dynamic link library that doesn't exists in java. Other modules are missing from Jython just because nobody have had a need for it before and no-one have tested the CPython module with Jython. If you discover that you are missing a module, try to copy the .py file from a CPython distribution to a directory on your Jython sys.path. If that works you are set. If it doesn't work, try asking on jython-users mailing list.

Other Problems

Any other problems with the installation should be reported to jython-dev.

As a workaround you can extract the jython-21.class manually. The class file is basicly a .zip file and most unzip programs can manage to extract the contents of the class into a directory. After doing that, you must

  • Remove the net directory. It isn't needed.
  • Create the startup script by hand. Use the installer/template* files as a starting point in doing so.

Platform Specific Notes

If all else fails, you might find that your problem is unique to your platform, and has a solution mentioned on the Platform Specific Information page.