Jython 2.7.0 “Final Release” on Windows - difficul

2019-09-19 02:08发布

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?

1条回答
聊天终结者
2楼-- · 2019-09-19 02:42

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...

查看更多
登录 后发表回答