我尝试使用Jython将一个小Python脚本集成到我现有的Java程序中。我似乎无法使用javax.script
包获得python/jython引擎。在
我从here获取了代码,并添加了一个小代码来生成:
andrew@asimov:~$ echo $CLASSPATH
/opt/jython/jython.jar:.
andrew@asimov:~$ java Engines
The following 2 scripting engines were found
Engine name: jython
Version: 2.7.0
Language: python
Engine supports the following extensions:
py
Engine has the following short names:
python
jython
=========================
Engine name: Rhino
Version: Rhino 1.7 release 4 2013 08 27
Language: ECMAScript
Engine supports the following extensions:
js
Engine has the following short names:
js
rhino
JavaScript
javascript
ECMAScript
ecmascript
=========================
python engine is null: true
js engine is null: false
andrew@asimov:~$
我添加的代码是:
^{pr2}$为什么我得到一个空的python引擎?在
我遇到了this bug,这似乎表明存在(或曾经)一个jython-引擎.jar在外面,但如果我能找到它,我就被绞死了。在
对于this question,使用
jython-standalone.jar
而不是jython.jar
返回一个非空引擎:(在我的pom.xml文件,我使用了
<artifactId>jython-standalone</artifactId>
)很好奇,但至少我可以继续。在
相关问题 更多 >
编程相关推荐