문제

I have a Java project in Netbeans and I want to use some classes from Weka within my project.

I added the file C:\Program Files\Weka-3-7\weka-src.jar into my Libraries following the instructions here (project, properties, libraries ..)

So how do I now import the classes I want?

I tried importing like this:

import weka.core.converters.ConverterUtils.DataSource;

And for kicks, I also tried this which didn't work either:

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

NetBeans says "package does not exist" for both.

Have I linked the libraries incorrectly? Do I need to phrase the import differently?

Much thanks for any insight into this you can provide.

Update:

In my Libraries folder of my projects tab I see:

weka-src.jar and under that I see: , META-INF, lib, src.main.java.weka.associations, and lots of other things from weka.

도움이 되었습니까?

해결책

I have downloaded Weka from here. I have added the JAR file you mentioned and I have also added weka-src.jar.

The problem is that although I have no problems with your first import:

import weka.core.converters.ConverterUtils.DataSource;

I can't see this package anywhere:

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

To see if you have successfully imported a .jar file or a library, click on the "Projects" button on the left margin, find the Project you have added the resource to and expand the view (by pressing the + sign). You should have an item named "Libraries". If you expand that, you should be able to see the files you have added.

다른 팁

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"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top