Jython 2.7.0“最终版本”在Windows - 困难包括jar [英] Jython 2.7.0 "Final Release" on Windows - difficulty including jars

查看:988
本文介绍了Jython 2.7.0“最终版本”在Windows - 困难包括jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个使用Jython 2.7b1运行的项目,其中我通过这样做添加jars(实际上是一个目录中的所有jars):

  set CLASSPATH = .;%SYSADMIN%\resources\java jar files / *
set JYTHONPATH = ...
C:\ jython2.7b1 \但是我最新的项目是使用2.7.0FR和这个设置CLASSPATH 方法似乎不工作。然后我尝试这样:

  D:\apps\jython2.7.0\bin\jython -Dpython.path = %SYSADMIN%\resources\java jar files / *my_latest_proj\__main __。py 

...但它没有工作。然后我想看看是否可以加载个人.jar:

  D:\apps\jython2.7.0\ bin \jython -Dpython.path =%SYSADMIN%\resources\java jar files\lucene-analyzerers-common-4.6.0.jarmy_latest_proj\__main __。py 

这也没有工作:

 从org.apache.lucene.analysis.fr导入FrenchAnalyzer 

会导致以下错误:没有模块命名为apache...也没有任何解包的jar,你通常看到Jython第一次使用一个jar。



最后我尝试过:

 设置CLASSPATH = .;%SYSADMIN%\resources\java jar files\lucene- analyzerers -common-4.6.0.jar

...同样的事情:没有模块命名为apache



NB在Eclipse下运行时,我没有任何麻烦让Jars在我的项目中工作。



任何人都告诉我我做错了什么?

解决方案



1) 出现在Jython2.7.0FR中,您必须使用 strong>在CLASSPATH中的路径中,即使在Windows操作系统中。这似乎是相对于2.7b1的变化...



2)我也似乎发现带空格的路径 ...以前我可以在引号中包含这样的路径,它会工作确定。这似乎不工作了。



欢迎来自JythonHigh Command的任何意见...


I have a few projects which run using Jython 2.7b1 where I add the jars (in fact all the jars in a directory) by doing this:

set CLASSPATH=.;"%SYSADMIN%\resources\java jar files/*"
set JYTHONPATH=...
C:\jython2.7b1\jython myproj\__main__.py 

But my latest project is using 2.7.0FR and this "set CLASSPATH" approach doesn't seem to work. I then tried this:

D:\apps\jython2.7.0\bin\jython -Dpython.path="%SYSADMIN%\resources\java jar files/*" my_latest_proj\__main__.py

... but it didn't work. Then I wanted to see whether I could load an individual .jar:

D:\apps\jython2.7.0\bin\jython -Dpython.path="%SYSADMIN%\resources\java jar files\lucene-analyzers-common-4.6.0.jar" my_latest_proj\__main__.py 

This didn't work either: the following line

from org.apache.lucene.analysis.fr import FrenchAnalyzer

leads to the following error: "No module named apache"... nor is there any "unpacking" of the jar as you typically see with Jython the first time you use a jar.

Finally I tried this:

set CLASSPATH=.;"%SYSADMIN%\resources\java jar files\lucene-analyzers-common-4.6.0.jar"

... same thing: "No module named apache"

NB I have no trouble getting jars to work from within my project when running it under Eclipse.

Can anyone tell me what I'm doing wrong?

解决方案

Aha...!

1) It appears that with Jython2.7.0FR you have to use forward slashes in paths in the CLASSPATH, even in a Windows OS. This appears to be a change relative to 2.7b1...

2) I also seem to find that paths with spaces are to be avoided... previously I could enclose such a path in quotes and it would work OK. This seems not to work any more.

Any comments from the Jython "High Command" would be welcome...

这篇关于Jython 2.7.0“最终版本”在Windows - 困难包括jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆