我编写java代码将CSV文件转换为使用随机森林算法在分类任务中使用的向量。我使用mahout 0.10.0,hadoop 2.6.0和eclipse。然后,我尝试使用该命令从cmd运行此代码:
hadoop jar /path to my jar/CSVToVector.jar com.classification.csvtovector.CSVToVector
但我收到了这个错误:
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包含以下内容:
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
我需要做些什么才能解决这个问题?我是mahout和hadoop的新手。