|
From: Robert W. B. <rb...@di...> - 2001-11-25 19:17:32
|
On Sun, 25 Nov 2001, Romain Guy wrote:
> Is there a way to tell the Python interpreter where to put its cache
> directory (I'd like to do something like this :
> interpreter.setCacheDir(System.getProperty("user.home") + "/myApp");
The property is "python.cachedir", and you can set it in the call to
PythonInterpreter's initialize method. Jython's registry file explains the
python.cachedir property.
Properties props = new Properties();
props.put("python.home", "/path/to/jython");
props.put("python.cachedir", "/path/to/cachedir");
PythonInterpreter.initialize(System.getProperties(),
props, new String[0]);
> Also is there a way to retrieve the interpreter package managers so that
> I could manually add my JARs to the cache (it would then let me use Jython
> with my app in a webstart release).
sys.add_extdirs(directoryContainingYourJars) is the easy way.
For individual jars, you abuse the "public" status of packageManager and
addJar with the following (untested, sorry):
PySystemState sys = Py.getSystemState();
sys.packageManager.addJar("/usr/local/jakarta-tomcat-3.2.3/lib/parser.jar");
-robert
|