Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weka from Command Line

I'm trying to run the Weka ML package from the command line without the GUI popping up. I tried:

java -jar "\C:\Program Files\Weka-3-6\weka.jar"

That makes the applet initialize and nothing else. So I appended arguments, specific to my problem:

java -jar "\C:\Program Files\Weka-3-6\weka.jar"
weka.classifiers.functions.MultilayerPerceptron
-t data.arff -T test.arff 2> y.txt

All on one line, but broken up for clarity. This does actually generate some output in y.txt as I'll need to read it later, but it gives:

---Registering Weka Editors---
Trying to add database driver (JDBC): RmiJdbc.RJDriver - Error, not in CLASSPATH?
Trying to add database driver (JDBC): jdbc.idbDriver - Error, not in CLASSPATH?
Trying to add database driver (JDBC): org.gjt.mm.mysql.Driver - Error, not in CLASSPATH?
Trying to add database driver (JDBC): com.mckoi.JDBCDriver - Error, not in CLASSPATH?
Trying to add database driver (JDBC): org.hsqldb.jdbcDriver - Error, not in CLASSPATH?

I'm not concerned about the above, because JDBC is database-related, which I'm not dealing with. But after that:

java.lang.NullPointerException
weka.gui.GUIChooser.showExplorer(GUIChooser.java:1099)
weka.gui.GUIChooser.main(GUIChooser.java:1371)

at weka.gui.GUIChooser.showExplorer(GUIChooser.java:1099)
at weka.gui.GUIChooser.main(GUIChooser.java:1371)

And I'm not sure how to continue. Does anyone have any weka experience?

like image 687
aquemini Avatar asked Dec 09 '25 23:12

aquemini


1 Answers

You need to learn how java command lines work. :-) Your question is a Java thing, not specific to Weka.

java -cp weka.jar weka.classifiers.functions.MultilayerPerceptron

works for me. Notice the difference between -cp and -jar. The latter will run the "main" class as specified in the .jar, but here you want to manually give the main class as first parameter.

like image 144
Has QUIT--Anony-Mousse Avatar answered Dec 12 '25 13:12

Has QUIT--Anony-Mousse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!