Win7 Eclipse 搭建spark java1.8环境:WordCount helloworld例子

[学习笔记]

Win7 Eclipse 搭建spark java1.8环境:WordCount helloworld例子
在eclipse oxygen上创建一个普通的java项目,然后把spark-assembly-1.6.1-hadoop2.6.0.jar这个包导进工程就ok了。只要启动start-dfs,下面的程序就可以运行了。


package com;
import java.util.Arrays;
import java.util.List;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.api.java.function.Function2;
import org.apache.spark.api.java.function.PairFunction;
import org.apache.spark.api.java.function.VoidFunction;
import scala.Tuple2;

public class WordCount1 {
    public static void main(String[] args) {
        SparkConf conf = new SparkConf().setMaster("local").setAppName("wc");

更多内容请见原文,文章转载自原文:https://blog.csdn.net/qq_44596980/article/details/93384785

posted @ 2019-08-03 08:53  海中一神兽  阅读(383)  评论(0编辑  收藏  举报