3

我在 Netbeans 中有一个 Java 项目,我想在我的项目中使用Weka的一些类。

我按照此处的说明(项目、属性、库..)将文件 C:\Program Files\Weka-3-7\weka-src.jar 添加到我的库中

那么我现在如何导入我想要的类呢?

我尝试像这样导入:

import weka.core.converters.ConverterUtils.DataSource;

为了踢球,我也尝试了这个,但也没有用:

import src.main.java.weka.core.converters.ConverterUtils.DataSource;

NetBeans 对两者都说“包不存在”。

我是否错误地链接了库?我需要以不同的方式对导入进行表述吗?

非常感谢您对此提供的任何见解。

更新:

在我的项目选项卡的库文件夹中,我看到:

weka-src.jar 并在其下我看到:、META-INF、lib、src.main.java.weka.associations 以及来自 weka 的许多其他内容。

4

2 回答 2

4

我已经从这里下载了 Weka 。我已经添加了你提到的 JAR 文件,我还添加了 weka-src.jar。

问题是,虽然我对您的第一次导入没有任何问题:

import weka.core.converters.ConverterUtils.DataSource;

我在任何地方都看不到这个包裹:

import src.main.java.weka.core.converters.ConverterUtils.DataSource;

要查看您是否已成功导入 .jar 文件或库,请单击左边距的“项目”按钮,找到您已将资源添加到的项目并展开视图(按 + 号)。您应该有一个名为“库”的项目。如果你展开它,你应该能够看到你添加的文件。

于 2010-08-08T19:39:37.897 回答
0

I was looking for how to install Weka Jar file too, and I read this tutorial and I realize that the jar file is actually on you Weka installer, and then you just need to import the jar file as same as any other library. Take a chance to look this tutorial, it is pretty cool.

http://www.cs.umb.edu/~ding/history/480_697_spring_2013/homework/WekaJavaAPITutorial.pdf

"Logic will take you from point A to point B, imagination will take you everywhere"

于 2015-12-02T06:15:51.313 回答