0
votes

My code is:

package csvtoarff;

import java.io.File;
import weka.core.Instances;
import weka.core.converters.ArffSaver;
import weka.core.converters.CSVLoader;

public class CsvToArff {
    public static void main(String[] args) {
        try {
            String f1 = "C://Users//user//Desktop//testfold//test.csv";
            String f2 = "C://Users//user//Desktop//testfold//output.arff";

            // load the CSV file (input file)
            CSVLoader loader = new CSVLoader();
            loader.setSource(new File(f1));
            String [] options = new String[1];
            options[0]="-H";
            loader.setOptions(options);

            Instances data = loader.getDataSet();
            System.out.println(data);

            // save as an  ARFF (output file)
            ArffSaver saver = new ArffSaver();
            saver.setInstances(data);
            saver.setFile(new File(f2));
            saver.setDestination(new File(f2));
            saver.writeBatch();
        } catch(Exception e) {
        }
    }
}

Error is:

---Registering Weka Editors--- Trying to add database driver (JDBC): jdbc.idbDriver - Error, not in CLASSPATH?

This related answer doesn't solve my problem.

2
the link provided above doesnot give me solution.please, anyone knows it give me solution or at least hint to overcome itVivek

2 Answers

0
votes

Maybe you should add the InstantDB-driver to your classpath as it is mentioned in the error-message?

0
votes

Finally, I found answer.

Actually need not to worry about that error of database.just leave it as it is. and just mark comment to the line: " saver.setDestination(new File(f2));" because i am using newer version of weka and it does not need that line.