当我调用Jython *而不将它们添加到$ CLASSPATH时,如何将jar添加到类路径? [英] How can I add jars to the classpath when I invoke Jython *without* adding them to $CLASSPATH?
本文介绍了当我调用Jython *而不将它们添加到$ CLASSPATH时,如何将jar添加到类路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想做类似的事情jython -cp FOO:BAR:BAZ argle.py
。
如果我添加 FOO
, BAR
, BAZ
到 $ CLASSPATH
这是有效的。我试图在运行时将它们添加到 sys.path
,但这似乎不适用于jar。如果我在运行时将扩展jar的路径添加到 sys.path
, 可以正常工作。是否有一个简单的替代方案来爆炸jar文件?为每个运行此脚本的用户增加 $ CLASSPATH
是不可接受的替代方案。
If I add FOO
, BAR
, and BAZ
to $CLASSPATH
this works. I tried to add them to sys.path
at run-time, but that doesn't appear to work for jars. It does work if I add a path to the expanded jars to sys.path
at runtime. Is there a simple alternative to exploding the jar files? Augmenting $CLASSPATH
for every user that runs this script is not an acceptable alternative.
谢谢。
推荐答案
您可以使用 -D
选项设置 python .path
:
jython -Dpython.path=FOO:BAR:BAZ argyle.py
这篇关于当我调用Jython *而不将它们添加到$ CLASSPATH时,如何将jar添加到类路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文