Table Of Contents

Previous topic

Welcome to Jynx !

Next topic


This Page

Introduction: What is Jynx?

Jynx is a Jython library which makes life easier for Python programmers who intend to work within the Javaverse. Jynx, specifically uses dynamic Java compilation techniques that advance Python as a scripting language for Java.

Dynamic Java Compilation in Jython

Dynamic Java compilation deals with one of the following transformation chains

Java source -> Java class -> Jython class


Jython source -> Java stub calling Jython -> Java class -> Jython class

The first of the chains is used to assemble Java source on the fly, generate Java bytecode, load the bytecode with Javas class loader and finally use the created class from Jython as a Jython type.

The second of the chains starts with Jython code, extracts the code, generates Java and proceeds like the first chain.

Everything is staged

Dynamic compilation shifts compile time Java into runtime Jython. The most important application of this move are Java annotations generated from Jython. Java annotations are declared in Jython classes. Jython classes are extracted and new Java classes are build from them containing those annotations. Those Java classes are loaded into Jython and can be plugged into modern Java frameworks that rely on the presence of annotations like JUnit 4 or Hibernate.

The adventure begins

What if we just trivialize the use of many Java APIs and frameworks using Jython? The Java Compiler API is a successful demonstration of this idea and the center piece of Jynx. The rationale behind this is different from the one of porting popular Python web frameworks like Django to Jython. Instead we attempt to create thin layers above Java frameworks turning them into direct and succinct pythonic solutions.

Jynx’s development philosophy is one of handtaming huge animals, not growing the zoo.