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");
文章转载自原文: