问题
I write java code to convert CSV file to vectors to use in classification task using random forest algorithm.I use mahout 0.10.0, hadoop 2.6.0 and eclipse.Then, I try to run this code from cmd using that command:
hadoop jar /path to my jar/CSVToVector.jar com.classification.csvtovector.CSVToVector
But I got this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/mahout/math/Vector
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.hadoop.util.RunJar.run(RunJar.java:214)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.ClassNotFoundException: org.apache.mahout.math.Vector
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
.bash_profile contains the following:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin
export HADOOP_PREFIX=/Users/jooody/hadoop
export HADOOP_HOME=$HADOOP_PREFIX
export HADOOP_COMMON_HOME=$HADOOP_PREFIX
export HADOOP_CONF_DIR=$HADOOP_PREFIX/etc/hadoop
export HADOOP_HDFS_HOME=$HADOOP_PREFIX
export HADOOP_MAPRED_HOME=$HADOOP_PREFIX
export HADOOP_YARN_HOME=$HADOOP_PREFIX
export PATH=$PATH:$HADOOP_PREFIX/bin:$HADOOP_PREFIX/sbin
export MAHOUT_HOME=/Users/jooody/mahout
export PATH=$PATH:/Users/jooody/mahout/bin
export MAHOUT_CONF_DIR=/Users/jooody/mahout/src/conf
export M2_HOME=/Users/jooody/maven/apache-maven-3.2.5
export PATH=$PATH:$M2_HOME/bin
What I need to do to solve this problem? I'm new to mahout and hadoop.
来源:https://stackoverflow.com/questions/32697852/exception-in-thread-main-java-lang-noclassdeffounderror-org-apache-mahout-mat