onyourmark
asked on
Could not find the main class
Hello. I entered
;C:\Program Files (x86)\Java\jre6\bin to my Path environment variable. I am running Vista Ultimate on 64 bits.
Then I went to the command prompt and entered
java weka.core.converters.CSVLo ader data.csv > data.arff
I get a message:
C:\Users\william>java weka.core.converters.CSVLo ader data.csv > data.arff
Exception in thread "main" java.lang.NoClassDefFoundE rror: weka/core/converters/
CSVLoader
Caused by: java.lang.ClassNotFoundExc eption: weka.core.converters.CSVLo ader
at java.net.URLClassLoader$1. run(Unknow n Source)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(Un known Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at sun.misc.Launcher$AppClass Loader.loa dClass(Unk nown Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at java.lang.ClassLoader.load ClassInter nal(Unknow n Source)
Could not find the main class: weka.core.converters.CSVLo ader. Program will exi
t.
By the way, is there an easy way to copy from the Command Prompt?
;C:\Program Files (x86)\Java\jre6\bin to my Path environment variable. I am running Vista Ultimate on 64 bits.
Then I went to the command prompt and entered
java weka.core.converters.CSVLo
I get a message:
C:\Users\william>java weka.core.converters.CSVLo
Exception in thread "main" java.lang.NoClassDefFoundE
CSVLoader
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
at java.lang.ClassLoader.load
Could not find the main class: weka.core.converters.CSVLo
t.
By the way, is there an easy way to copy from the Command Prompt?
you need to weka jar files/libraries into classpath...
for the classNotFoundException:
You need to make sure that you are executing that java command just outside the 'weka' folder.
I am assuming that
1) class files are generated (no compilation errors)
2) required jars/libs are in classpath
You need to make sure that you are executing that java command just outside the 'weka' folder.
I am assuming that
1) class files are generated (no compilation errors)
2) required jars/libs are in classpath
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi. Thank you for the help. I am confused. Do I need to edit my Path variable in some other way or my CLASSPATH variable? I do have Java installed in C:\Program Files (x86)\Java\jre6\bin
and I do have Weka installed at
C:\Program Files (x86)\Weka-3-7
and I do have Weka installed at
C:\Program Files (x86)\Weka-3-7
what does "C:\Program Files (x86)\Weka-3-7" includes?
ASKER
Hi. Here is a screen shot
weka.jpg
weka.jpg
i can see weka.jar file there. Is it added in the classpath?
ASKER
In Environment Variables my CLASSPATH has
.;C:\Program Files (x86)\Java\jre6\lib\ext\QT Java.zip
.;C:\Program Files (x86)\Java\jre6\lib\ext\QT
ASKER
Here is my directory
java.jpg
java.jpg
Add "C:\Program Files (x86)\weka.jar" also in the classpath.
ASKER
Hello. I added
then tried
java weka.core.converters.CSVLo ader data.csv > data.arff
I get
Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\william>java weka.core.converters.CSVLo ader data.csv > data.arff
Exception in thread "main" java.lang.NoClassDefFoundE rror: weka/core/converters/
CSVLoader
Caused by: java.lang.ClassNotFoundExc eption: weka.core.converters.CSVLo ader
at java.net.URLClassLoader$1. run(Unknow n Source)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(Un known Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at sun.misc.Launcher$AppClass Loader.loa dClass(Unk nown Source)
at java.lang.ClassLoader.load Class(Unkn own Source)
at java.lang.ClassLoader.load ClassInter nal(Unknow n Source)
Could not find the main class: weka.core.converters.CSVLo ader. Program will exi
t.
C:\Users\william>
then tried
java weka.core.converters.CSVLo
I get
Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\william>java weka.core.converters.CSVLo
Exception in thread "main" java.lang.NoClassDefFoundE
CSVLoader
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
at java.lang.ClassLoader.load
Could not find the main class: weka.core.converters.CSVLo
t.
C:\Users\william>
ASKER
Sorry, I added
;C:\Program Files (x86)\weka.jar
;C:\Program Files (x86)\weka.jar
try this
java -classpath "C:/Program Files (x86)/weka.jar" weka.core.converters.CSVLo ader data.csv > data.arff
java -classpath "C:/Program Files (x86)/weka.jar" weka.core.converters.CSVLo
ASKER
I get the same error
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi. I am not sure how to locate that. I looked on the internet and find
http://weka.sourceforge.net/doc/weka/core/converters/CSVLoader.html
http://weka.sourceforge.net/doc/weka/core/converters/CSVLoader.html
can you try this (both commands)
set CLASSPATH=%CLASSPATH%;C:\P rogram Files (x86)\weka.jar;
java weka.core.converters.CSVLo ader data.csv > data.arff
set CLASSPATH=%CLASSPATH%;C:\P
java weka.core.converters.CSVLo
ASKER
Hi thanks. I tried that but I get the error on the second command.