Other Examples in Jython

DocumentationAndEducation


Log4j

Apache Poi

PyServlet

See Sean McGrath's PyServlet Turorial for an introduction. Below are a couple of examples:

Simple:

   1 from javax.servlet.http import HttpServlet
   2 
   3 class Simple(HttpServlet):
   4     def doGet(self, request, response):
   5         response.setContentType("text/plain")
   6         response.getWriter().println("Veni, vidi, vici!")

Using servlet context:

   1 from javax.servlet.http import HttpServlet
   2 
   3 class Simple(HttpServlet):     
   4     def doGet(self, request, response):
   5         response.setContentType("text/plain")
   6         response.getWriter().println(self.getServletContext().getServerInfo() +
   7                                      " Veni, vidi, vici!")

Apache Derby

ApacheDerby Example(s)

Apache Derby is a Java relational database management system that can be embedded in Java programs and used for online transaction processing. for more information on Apache Derby see http://db.apache.org/derby/index.html or http://en.wikipedia.org/wiki/Apache_Derby

BioJava

Bioinformatic analysis using BioJava can be simplified using Jython. A Genbank file, like the ones used to describe chromosomes in the Human Genome can be open and parsed with a few lines of Jython.

import sys
from java.io import *
from java.util import *
from org.biojava.bio import *
from org.biojava.bio.seq.db import *
from org.biojava.bio.seq.io import *
from org.biojava.bio.symbol import *

if __name__ == "__main__":
    br = BufferedReader( FileReader( sys.argv[1] ) )
    sequences = SeqIOTools.readGenbank(br)
    while sequences.hasNext():
        seq = sequences.nextSequence()
        print seq.seqString()