You can put libsvm.jar
in a folder of your choice, e.g. ~/Library/Java
, and then run weka from the command-line as follows:
$ java -Xmx512m -classpath /Users/chl/weka/weka.jar:/Library/Java/libsvm.jar weka.gui.GUIChooser
You can also update your CLASSPATH
to reflect locations where *.jar
files can be found. I have the following in my .profile
:
export CLASSPATH="/Users/chl/weka/weka.jar:~/Library/Java/*"
(You will need to replace /Users/chl/weka
to reflect the correct location of your weka.jar
; usually, it is located at the top of the directory if you downloaded the source files, or under weka-3-7-3.app/Contents/Resources/Java/
if you use the bundled app.)
This way, the first command to start weka GUI simplifies to
$ java -classpath $CLASSPATH:weka.jar:libsvm.jar weka.gui.GUIChooser
Don't use java -jar
since it will override the CLASSPATH
, as discussed here.
I also have an alias in my .bash_aliases
for wrapping all that stuff:
alias weka='java -Xmx512m -classpath $CLASSPATH:weka.jar'
in order to use weka from the command-line as, e.g.
$ weka weka.classifiers.trees.RandomTree -t iris.arff -i