03.06.2013 12:37, simon nasrallah kirjoitti:
Hi ,
This may be of interest to someone so I thought I'd post some info
on how I got Jython in a Java project running over JNLP a.k.a Webstart .
I've been running Jython via Webstart for a few years now.
My recipe is this:
1. Sign the regular jython jar file
2. Package and sign the Lib directory contents
3. (Optionally compile and) package and sign your own app

No pyclasspath managing is required. Of course you can combine 1. and 2. into a single archive if you want.

I'm sure I've made some classic mistakes, but it does work.

One of the many problems I had was adding a path to my *.py files over JNLP
the python.path I had in my project worked fine locally but when using
it in a sandboxed webstart environment I had to do quite a few extra steps.

1. found I had to explode the jython.jar into the distribution and then just jarsign the one jar
2. had to add "__pyclasspath__/dsi" to find my *.py files (see below)
3. had to add "__pyclasspath__/Lib" to find Jython's distro *.py files (see below)

code snippet to set pyclasspath from
        String path1 = "__pyclasspath__/Lib";
        String path2 = "__pyclasspath__/dsi";
        Properties props = new Properties();

        if (System.getProperty("os.name").startsWith("Win")){
            props.setProperty("python.path", path1 + ";" + path2);
        } else{
            props.setProperty("python.path", path1 + ":" + path2);
        PythonInterpreter.initialize(System.getProperties(), props,
                new String[] {""});

        PySystemState pySysState = new PySystemState();
        log.info("Jython sys state initialized. sys.path: " + pySysState.path);

Example project is here (you need java 7):

Jython code is here:


To see it running via jnlp (note the jtable summary of disk space is in jython):

Be interested to see if anyone has had these issues.


Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.

Jython-users mailing list