2.3. Installing Jython
To install Jython, you need a Java Virtual Machine (JVM) that complies with Java 1.1 or higher. See http://www.jython.org/platform.html for advice on JVMs for your platform.
To download Jython, visit http://www.jython.org and follow the link labeled Download. The latest version, which at the time of this writing (supporting some Python 2.3 features, as well as all of Python 2.2) is:
In the following section, for clarity, I assume you have created a new directory named C:\Jy and downloaded jython-22.class there. Of course, you can choose to name and place the directory as it best suits you. On Unix-like platforms, in particular, the directory name will probably be something like ~/Jy.
The Jython installer .class file is a self-installing program. Open an MS-DOS Prompt window (or a shell prompt on a Unix-like platform), change directory to C:\Jy, and run your Java interpreter on the Jython installer. Make sure to include directory C:\Jy in the Java CLASSPATH. With most releases of Sun's Java Development Kit (JDK), for example, you can run:
C:\Jy> java -cp . jython-22
This runs a GUI installer that lets you choose destination directory and options. If you want to avoid the GUI, you can use the -o switch on the command line. The switch lets you specify the installation directory and options on the command line. For example:
C:\Jy> java -cp . jython-22 -o C:\Jython-2.2 demo lib source
installs Jython, with all optional components (demos, libraries, and source code), in directory C:\Jython-2.2. The Jython installation builds two small, useful command files. One, run as jython (named jython.bat on Windows), runs the interpreter. The other, run as jythonc, compiles Python source into JVM bytecode. You can add the Jython installation directory to your PATH or copy these command files into any directory on your PATH.
You may want to use Jython with different JDKs on the same machine. For example, while JDK 1.5 is best for most development, you may also need to use JDK 1.1 occasionally in order to compile applets that can run on browsers that support only Java 1.1. In such cases, you could share a single Jython installation among multiple JVMs. However, to avoid confusion and accidents, I suggest you perform separate installations from the same Jython download on each JVM you want to support. Suppose, for example, that you have JDK 1.5 installed in C:\Jdk15 and JDK 1.1 installed in C:\Jdk11. In this case, you could use the commands:
C:\Jy> \Jdk15\java -cp . jython-22 -o C:\Jy22-15 demo lib source C:\Jy> \Jdk11\java -cp . jython-22 -o C:\Jy22-11 demo lib source
With these installations, you could then choose to work off C:\Jy22-15 most of the time (e.g., by placing it in your PATH) and cd to C:\Jy22-11 when you specifically need to compile applets with JDK 1.1.