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