public class classifyTweet {
public static class MapClass
extends Mapper<LongWritable, Text, Text, Text> {
static final Configuration conf = new Configuration();
protected void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
StandardNaiveBayesClassifier classifier = new StandardNaiveBayesClassifier(NaiveBayesModel.materialize(new Path(modelPath), conf));
}
}
}
我想只有一次初始化变量的分类,物化方法抛出IOEception,如果我声明它之外的地图方法和类似配置对象初始化它给IOException的编译错误。我怎样才能初始化它只有一次?静态类中的IO异常 - java的
提供该异常的堆栈跟踪。 –
在编译时出现错误..未报告IOException必须被捕获或抛出 –