Jython is an implementation of Python seamlessly integrated with the Java platform. The predecessor to Jython, JPython, is certified as 100% Pure Java.

Jython is freely available for both commercial and non-commercial use and is distributed with source code.

JPython was created in late 1997 by Jim Hugunin, who is now working for Xerox PARC's Aspect Oriented Programming project. It seems that Jim was initially primarily interested in the challenge, since many people (including Guido Van Rossum himself) just did not think it could be done, and Jim proved them wrong.

In October 2000, Barry Warsaw helped move the software to an online open-source collaborative development environment at SourceForge where it was renamed to Jython. Jython 2.0 is now developed by a group of volunteers.

Jython is not always a competitor to Java; it is also the perfect complement to it. Java is a statically typed, compiled language. This ensures type-safety of libraries and faster execution speeds. It is interesting that although it is bytecode-interpreted, most people see Java as a traditional write-compile-run-edit program.

Moreover, Java leverages a huge segment of the software world, so there are many resources available to the Java programmer. The seamless interaction between Python and Java allows developers to freely mix the two languages both during development and in shipping products.

The same static typing and traditional programming cycle increase the cost of Java application development in terms of human resources, and here, introducing Python absolutely excels.

The Python’s interactive interpreter is also available in Jython, which means you can sit at the interpreter prompt, import Java code, create Java class instances, make method calls, etc., all interactively. This is a wonderful tool for training programmers how to use corporate Java libraries, or for experimenting with new Java APIs.

Jython gives complete access to its underlying implementation language. In most (probably all) C-based script languages, a C function has to be wrapped in a thin layer of code that serves to expose the C function to the script language, and fine tools such as SWIG exists to automate the creation of this wrapper code for Python.

However, Jython does not require the wrapper in the first place. All Java code ever written is directly available for use from Jython, and the integration goes both ways. Classes and instances defined in Jython can be passed to Java code, as long as they inherit a Java class or an interface, or explicitly describe the method signatures of all their methods.

The embedding/extending API makes access to Jython objects from within an application or module quite simple. Java programmers can add the Jython libraries to their system to allow end users to write simple or complicated scripts that add functionality to the application.

Even though in general feature-wise Jython is lagging behind CPython, in some cases it is vice versa. One current example of this is in Unicode support. Jython is already all-Unicode.

Another example is the types/class dichotomy. In CPython, you have built-in types like strings, dictionaries, lists and numbers. You also have classes and instances. The built-in types cannot be inherited from; in addition, to add more confusion, an instance has both a type and a class. It may be easier to fix this rift in Jython first because of its object-oriented implementation.

Even though usually compilation to Java bytecodes is done dynamically - leading to highest possible performance without sacrificing interactivity, optional static compilation – allowing creation and portable deployment of applets, servlets, JavaBeans and EJBs – is possible as well.

Jython is valuable for all kinds of tasks, from providing an approachable scripting environment for end users, to making it easy to create testing frameworks for Java libraries and applications, to developing complete systems using it.

Jython is gaining in popularity because it allows programmers to explore the myriad Java libraries that are becoming available in an interactive, rapid turnaround environment. It also is proving useful to embed Python as a scripting language in Java frameworks, for customization, testing and other programming tasks by end users (as opposed to systems developers).

The official Jython website is http://www.jython.org.

Log in or register to write something here or to contact authors.