Informatics / TAMS / Applets / Interactive Jython Console
Description
This applet provides a fully functional Jython interpreter in a simple Swing GUI. Type your Jython commands into the command line at the bottom of the window and read the results in the log panel.
The applet
 

Sorry, but your browser seems to ignore Java-applets.
Enable Java in your browser preferences,
and reload this page to start the Jython console applet.


Note: the Jython console applet uses its own toplevel window.
Applet Requirements
The internal workings of the Jython interpreter rely on certain operations that are not permitted for Java applets by default. Therefore, you will have to change your Java policy file to grant the following permissions to the applet, or the applet will not run. You will have to reload this page after changing your policy file. Please check your browser and JDK/JRE/Java plugin documentation for the details about the policy file location and syntax. For example, on Unix/Linux systems, the policy file is called .java.policy and located in your home directory.

First, the applet needs a PropertyPermission because the Jython interpreter initialization reads your system properties. This is fairly low risk, but exposes your user name and home directory location to the applet. Second, Jython requires a few RuntimePermissions because it relies on its own classloader - the Jython input is first compiled to Java bytecodes which are then loaded into the Java virtual machine and executed by the Java VM. Allowing classloader access is dangerous in general, but absolutely necessary in this case.

Finally, if you would like to use your own Python input scripts with the applet, you will have to grant local file access to the applet. Note that you should never grant extra permissions to applets from unknown or untrustworthy sites - you will have to decide for yourself whether running Jython is worth the extra risk.

The following template policy file shows the (minimum) permissions required to run the Jython interpreter applet. The codeBase entries grant the permissions only to applets from this server:

/* AUTOMATICALLY GENERATED ON Thu Oct 04 11:12:41 CEST 2001*/
/* DO NOT EDIT */

grant codeBase "http://tams-www.informatik.uni-hamburg.de/applets/-" {
  permission java.util.PropertyPermission "*", "read,write";
};

grant codeBase "http://tams-www.informatik.uni-hamburg.de/applets/jython/-" {
  permission java.lang.RuntimePermission "createClassLoader";
  permission java.lang.RuntimePermission "getClassLoader";
  permission java.lang.RuntimePermission "getProtectionDomain";
};

grant codeBase "http://tams-www.informatik.uni-hamburg.de/applets/-" {
  permission java.io.FilePermission "<>", "read, write, delete, execute";
};
14.03.2003 Impressum
http://tams-www.informatik.uni-hamburg.de/applets/jython/index.html