Arash Hosseinabady
Arash Hosseinabady

Reputation: 31

How run mahout in action example ReutersToSparseVectors?

I want run "ReutersToSparseVectors.java". I can compile and created JAR file without problem.

I compiled this file by below command:

javac -classpath hadoop-core-0.20.205.0.jar:lucene-core-3.6.0.jar:mahout-core-0.7.jar:mahout-math-0.7.jar ReutersToSparseVectors.java

created JAR file with below command:

jar cvf ReutersToSparseVectors.jar ReutersToSparseVectors.class

When I write java -jar ReutersToSparseVectors.jar to run, give me below error:

Failed to load Main-Class manifest attribute from ReutersToSparseVectors.jar

Do you can help me to solve this problem?

IF this example can run with hadoop, please me that how i can run this with hadoop.

Upvotes: 0

Views: 1681

Answers (1)

Alex Ott
Alex Ott

Reputation: 87164

instead of using -jar option, then it's better to to run:

 java -cp mahout-core.jar:... mia.clustering.ch09.ReutersToSparseVectors

or you can use mvn exec:java command, as described in README for examples...

 mvn exec:java -Dexec.mainClass="mia.clustering.ch09.ReutersToSparseVectors"

Or you can run this file directly from your IDE (assuming, that you correctly imported Maven project).

P.S. your command isn't working, because to run with -jar switch, the .jar file should have special entry in manifest that describes that class should be started by default...

P.P.S. It's better to use book's examples with Mahout 0.7, as they were tested for it. You can use it with version 0.7 if you need, by then you need to take source code from mahout-0.7 branch of repository with examples (link is above)

Upvotes: 1

Related Questions