Message6832

Author amak
Recipients amak, irmen, whistler11783
Date 2012-03-19.18:37:36
SpamBayes Score 7.840724e-06
Marked as misclassified No
Message-id <1332182256.68.0.417138565319.issue1808@psf.upfronthosting.co.za>
In-reply-to
Content
There are several solutions for getting the process ID suggested on this blog post.

http://blog.igorminar.com/2007/03/how-java-application-can-discover-its.html

One promising approach is to set a java System property on the command line that starts jython, e.g.

"""
2. Using shell script in addition to Java properties Start your app with a shellscript like this:

exec java -Dpid=$$ -jar /Applications/bsh-2.0b4.jar

then in java code call:

System.getProperty("pid");
"""

you could then monkeypatch the os module like so

>>> import java
>>> import os
>>> os.getpid = lambda: java.lang.System.getProperty("pid")
History
Date User Action Args
2012-03-19 18:37:36amaksetmessageid: <1332182256.68.0.417138565319.issue1808@psf.upfronthosting.co.za>
2012-03-19 18:37:36amaksetrecipients: + amak, irmen, whistler11783
2012-03-19 18:37:36amaklinkissue1808 messages
2012-03-19 18:37:36amakcreate