title: Converting CSV to ARFF
body: <p>My code is:</p>
  
  <pre><code>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) {
          }
      }
  }
  </code></pre>
  
  <p>Error is:</p>
  
  <blockquote>
    <p>---Registering Weka Editors--- Trying to add database driver (JDBC): jdbc.idbDriver - Error, not in CLASSPATH?</p>
  </blockquote>
  
  <p><a href="https://stackoverflow.com/a/15350557/983430">This related answer</a> doesn't solve my problem.</p>