Yes you can (but that means you can only use java libraries, rather than python modules).  However your question was where to put resources -- and that's how I do it... ;-)

If you need to use the __future__ mod, you'll need to bundle the Lib dir.

On Mon, Nov 2, 2009 at 9:24 AM, <> wrote:

Surely we can deploy the standalone jar and nothing else?


From: Jason R Briggs []
Sent: 02 November 2009 09:22
To: Baker, John (IT/UK);

Subject: Re: [Jython-users] from and with keywords


If you're deploying in a war, then stick the Lib directory in the "classes" dir (for example), and then point the python path at that directory with something vaguely like:

Properties props = new Properties();
String jythonPath = libDir.getFile().getCanonicalPath();
props.put("python.path", jythonPath);
PythonInterpreter.initialize(System.getProperties(), props, null);

In my case, "libDir" is a prop injected by spring:

<property name="libDir" value="classpath:Lib" />

So you'll need to grab the canonical path according to whatever framework you're working within.

Dunno if that helps?


On Mon, Nov 2, 2009 at 8:40 AM, <> wrote:



I unzipped the jython package and I can run the jython jar using java –jar jython.jar.  The interpreter works fine.


What the instructions lack is how to copy the jython jar and resources elsewhere.  I don’t want to ship the entire jython zip file with my project; I want to place the relevant parts into a war file.


The #!/usr/bin/python is irrelevant – it’s there because the script has it, but it still doesn’t work without it.


The answer seems to lie in the lib directory – could you tell me how Jython loads resources from it?