0

I'm new to Weka. I downloaded it and can use the GUI interface, but I cannot figure out why I cannot run it from the command line (on a Mac OS X).

I'm in bash. When I do echo $PATH, I can see the path to weka.jar, but when I run

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

Error: Could not find or load main class weka.classifiers.functions.MultilayerPerceptron Caused by: java.lang.ClassNotFoundException: weka.classifiers.functions.MultilayerPerceptron

Now, I go to the weka folders and I can see that I have classifiers/functions/ there, but the files inside are only htmls.

I also tried

java weka.core.WekaPackageManager

Error: Could not find or load main class weka.core.WekaPackageManager Caused by: java.lang.ClassNotFoundException: weka.core.WekaPackageManager

0

2 Answers 2

1

You need to set the classpath

export CLASSPATH=/home/weka/weka.jar:$CLASSPATH
Sign up to request clarification or add additional context in comments.

Comments

0

I use this bash script to start wekafrom the command line:

#!/bin/bash
WEKA_HOME=/opt/smallapps/weka-3-9-1
export WEKA_JAR=$WEKA_HOME/weka.jar
export PATH=$WEKA_HOME:$PATH
CP="/usr/share/java/:/opt/dbvis9/jdbc/jtds/jtds.jar:/opt/database/sqlite/sqlite-
jdbc.jar:$WEKA_JAR"
echo "used CLASSPATH: $CP"
DIR=$WEKA_HOME
echo "changing to '$DIR'"
cd "$DIR"
export WEKA_HOME
# start small GUI Chooser, with 8GB of max memory
java -cp $CP -Xmx8092m weka.gui.GUIChooser &
#java -cp $CP -Xmx500m weka.gui.GUIChooser &

This also includes jarfiles with database drivers to the classpath

I think not all of these variables WEKA_HOME, WEKA_JAR, DIR etc are necessary, it's just what I'm using at the moment.

1 Comment

Thanks. But this is for the GUI version? I want the command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.