NetBeans - How to import a class from an external library

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

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

So how do I import the classes that I want?

I tried to import like this:

import weka.core.converters.ConverterUtils.DataSource;

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

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

NetBeans says the "package does not exist" for both.

Am I linking libraries incorrectly? Do I need to formulate imports differently?

Thanks so much for any understanding you can provide.

Update:

In my Libraries folder of my My Projects tab, I see:

weka-src.jar, :, META-INF, lib, src.main.java.weka.associations weka.

+3
2

Weka . JAR, , weka-src.jar.

, , :

import weka.core.converters.ConverterUtils.DataSource;

:

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

, .jar , "" , , , ( +), "". , , .

+4

Source: https://habr.com/ru/post/1758634/


All Articles