简体   繁体   English

错误包org.python.util不存在,使用ant进行编译

[英]error package org.python.util does not exist, compilation with ant

I am trying to call a python method in java, similar functionality as Unresolved import org.python / working with jython and java? 我正在尝试在Java中调用python方法,其功能与Unresolved import org.python /一起使用jython和Java?

However, I am using ant to compile and run my files. 但是,我正在使用ant来编译和运行文件。 using import org.python.util will give me this error 使用import org.python.util将给我这个错误

package org.python.util does not exist

I can see that python.org.util exists in jython-2.5.0.jar. 我可以看到jython-2.5.0.jar中存在python.org.util。

So, here is the class path I have in my build.xml ant file: 因此,这是我的build.xml ant文件中包含的类路径:

classpath="${java.class.path}:./jgrapht/lib/jgrapht-jdk1.5.jar:\
    ./jgrapht/lib/jgraph.jar:./jgraphx/lib/jgraphx.jar:\
    ./jython/lib/jython-2.5.0.jar:./colt/lib/colt.jar:."

and I also I added the path to jython jar files to my class path. 我也将jython jar文件的路径添加到了我的类路径中。 ie looks like echo $path gives me all the required paths. 即看起来像echo $path给了我所有必需的路径。 Is there anything missing here that I am not aware of? 这里有我不知道的东西吗?

Try this to make all classes in the package available: 尝试执行以下操作以使包中的所有类均可用:

import org.python.util.*;

Or this to include a particular class: 或这包括一个特定的类:

import org.python.util.TemplateAntTask;

EDIT: Also, looks like there is an extra slash after jython-2.5.0.jar in your classpath. 编辑:而且,看起来在类路径中jython-2.5.0.jar之后还有一个额外的斜杠。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM