0
votes

I'm trying to lance a perl script which calls weka.classifiers.trees.J48. I have several global thoughts to ask you and I appreciate your feedbacks.

1-WEKA is written in Java. In order to run weka.jar I need java. It's the same as having HelloWorld.jar

2-I installed Java and added it to Path variable.Weka.jar needs a few arguments. if i write java -jar *"c:\programs\weka.jar"* input1 input2 is it correct?

3-how about java -jar** "**c:\programs\weka.jar *input1 input2 *"** or java ** "c:\programs\weka.jar" input1 input2 -jar

4-I need the class weka.classifiers.trees.J48 . should i write java -jar *"c:\programs\weka.classifiers.trees.J48"* input1 input2 without .jar?

5-someone in stackoverflow suggested to put weka in a user environment variable which should be called CLASSPATH. my problem is i'm not sure if i should put WEKA folder in this environment variable (as we always do in path system env. variable) or i put weka.jar the file and not the folder in the CLASSPATH So, Assuming that weka.jar is now in my classpath,does the command change to java -jar weka.classifiers.trees.J48 input1 input2

I'm confused, i get Exception in thread "main" java.lang.NoClassDefFoundError: weka/classifiers/tree s/J48 I want to know how the command sequence works and if it's a general case. thanks for any insight

1

1 Answers

0
votes

Weka installation provides RunWeka.bat file. You can look its contents for an example. Also a different example I provided below.

To test your weka installation you can use weka.core.SystemInfo. This class does not expect any arguments. You can use this class to see if your command line environment can see weka jar.

wekaTest.cmd

SET WEKA_HOME=D:\atilla\tools\Weka-3-7
SET CLASSPATH=%CLASPATH%;%WEKA_HOME%\weka.jar
java weka.core.SystemInfo