Real Jython Applications

I recently started learning Python. I have not yet decided on coding. During one of my training sessions, I came across the term Jython.

I looked through it and got some info.

I would like to know if anyone ran a real program using Jython.

+6
python jython
source share
5 answers

In most cases, Jython is not used directly to write complete reading programs, but many programs actually implement Jython for use as a scripting language.

The official Jython website provides a list of projects, some written in Jython, others using Jython to write scripts: http://wiki.python.org/jython/JythonUsers

+10
source share

I am writing a complete application in Jython at the moment and highly recommend it. Having all the Java libraries at your disposal is very convenient, and the syntax and language functions of Python actually make some of them easier than in Java (I mainly talk about Swing here).

Check out the chapter on GUI applications from the Jython book . He makes many comparisons, such as “Look at all this Java code, and now look at its reduction to half-length Python code!”.

The only caveats I found are:

  • The development of Jython tends to lag a bit behind Python, which can be annoying if you find a cool way to do something in Python, only to find that it is not supported in the current version of Jython.
  • Sometimes you may have hiccups with an interface between Python and Java (I have some unresolved issues here and here , although there are always workarounds for this kind of thing).
  • Distribution is not as easy as it could be, although once you figure out how to do it, it is pretty painless. I recommend using the method here . It essentially consists of:
    • Explosion of jython.jar and adding its own modules to it.
    • Writing and compiling a small Java class that creates a Python interpreter and loads your Python modules.
    • Creating an .jar executable consisting of jython.jar modules, native Python modules, and a Java class.
+5
source share

WebSphere and WebLogic use it as the default scripting engine for administrative purposes.

Many other Oracle products ship it as part of their oracle_commons module (Oracle Universal Installer, Oracle HTTP Server, etc.). This is mainly version 2.2, which is a bit dated and clumsy.

+2
source share

Jython really shines for dependency injection.

You know these annoying variables that you have to give your program, for example

  • file system paths
  • server names
  • ports

Jython provides a really good way to input these variables by putting them in a script. It works equally well for injecting java dependencies.

+2
source share

There is a list of applications that use jython at http://wiki.python.org/jython/JythonUsers

+1
source share

All Articles