May be you should look in System properties:

import java.lang.System as System
System.getProperty("java.library.path")

I think the jar is there.

2011/8/28 Zhangguangchao <zhangguangchao@huawei.com>

No, it doesnít work. Besides, I used the code below, not work, either.

†††††††† systemState.path.remove(new PyString(jarFile.getAbsolutePath()));

†††††††† systemState.path.clear();

There is an important clue that if I use pythoninterpreter instance to execute a piece of python code like this :

pythonInterpreter.exec(pythonCode);

then , †the console report the information below:

*sys-package-mgr*: processing modified jar, 'E:\jars\catalina-ant-jmx.jar'

Then I canít delete the file : catalina-ant-jmx.jar.

However, I found that I can delete the jar file without executing any python code.

In a word, I can delete the jar file imported by jython interpreter if I didnít execute any python code with jython interpreter. I canít delete any jar files if I execute any python code because the jar files is modified by something.

Is there anything wrong with the interpreter action when processing the execution of† python code?

From: Pierre Thibault [mailto:pierre.thibault1@gmail.com]
Sent: Saturday, August 27, 2011 9:57 PM
To: jython-users@lists.sourceforge.net
Subject: Re: [Jython-users] help for how to stop embeded jython?

2011/8/27 Zhangguangchao <zhangguangchao@huawei.com>

Hi, jython experts,
I'm new to jython, and I met a problem that when I embed jython interpreter into my app, I find that after I execute the python script , the jar file which is appended to path of the PysystemState instance of the embedded interpreter can't be deleted.
Here is my usage of adding jar dynamically:
† † † †PySystemState systemState = pythonInterpreter.getSystemState();
† † † †systemState.path.append(new PyString(file.getAbsolutePath()));

Then I use the pythonInterpreter to execute some python code. However, when I wanna stop the jython engine, the jar file can't be deleted. Here is my stop code:
† † † †pythonInterpreter.cleanup();
† † † †pythonInterpreter = null;

Can anyone tell me how to stop the embedded jython properly in order to delete the imported jar ? Thanks a lot.

† † † † † † † † † † † † † † † † † † † †Dominic



Doing:

systemState.path.remove(new PyString(file.getAbsolutePath()));

instead?
--


A+

-------------
Pierre
My blog and profile (http://pierrethibault.posterous.com)
YouTube page (http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2)




--


A+

-------------
Pierre
My blog and profile (http://pierrethibault.posterous.com)
YouTube page (http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2)