I am trying to write a sample program that can call use the main method of "SequenceFilesFromDirectory", which aims to convert a set of files into sequence file format.
public class TestSequenceFileConverter {
public static void main(String args[]){
String inputDir = "inputDir";
String outputDir = "outoutDir";
开发者_开发问答SequenceFilesFromDirectory.main(new String[] {"--input",
inputDir.toString(), "--output", outputDir.toString(), "--chunkSize",
"64", "--charset",Charsets.UTF_8.name()});
}
}
But the Eclipse tells me that what I did was wrong with the following error message
Multiple markers at this line - Syntax error on token "main", = expected after this token - Syntax error on token(s), misplaced construct(s) - SequenceFilesFromDirectory cannot be resolved
I think I did not use this method correctly, but I don't know how to fix it? Thanks a lot.
The following is how the SequenceFilesFromDirectory defines. The API link for SequenceFilesFromDirectory is http://search-lucene.com/jd/mahout/utils/org/apache/mahout/text/SequenceFilesFromDirectory.html
My guess is that you're missing an import line from the first section of your file:
import org.apache.mahout.text.SequenceFilesFromDirectory;
I think your purpose for using SequenceFilesFromDirectory is to convert doc files to sequence files. If so, better to call the run()/runSequential()/runMapReduce() methods ater creating an object of SequenceFilesFromDirectory, because SequenceFilesFromDirectory.main() internally calls haddop ToolRunner.run() method for processing. Whereas the run methods of SequenceFilesFromDirectory do the actual processings.
精彩评论