开发者

Jython - How to get the path of the executed script

I've found many answer about the python way but what I found isn't working with jython.

I'm running a jython script using the WebSphere interpreter wsadmin -lang jython -f /p开发者_运维百科ath/to/script

I'd like to know the path of the script im running. This script if versionned and can be checked out anywhere so I need to reliably know where the script is being executed from.

Thanx to everyone


WebSphere doesn't make this easy. And I've yet to find a way to do this when using Sun's JVM running WebSphere on Solaris. However, you may be able to figure out the script name using the environment when running WebSphere on Linux, Aix and possibly others OSes. On these platforms, IBM's JVM sets the environment variable IBM_JAVA_COMMAND_LINE. You can parse it to get the '-f' argument passed to wsadmin.sh Dave Brand has code to do this on his blog. See fix #6 in his ibmfixes.py script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜