spark idea의 설정 문제

1535 단어 spark
아래의 잘못이 왜 그런지 모르겠다.
Error:scalac: missing or invalid dependency detected while loading class file 'RDD.class'. Could not access term hadoop in package org.apache, because it (or its dependencies) are missing. Check your build definition for missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) A full rebuild may help if 'RDD.class' was compiled against an incompatible version of org.apache.
저 i 밑에 이 버전은 뭐라고 써야 돼요?1.6.1이라고 써야지, 못 찾았어.
아래의 코드를 한 번 뛰어보고 싶은데, 사활에 문제가 있다. 아이고, 나는 자바라는 물건을 매우 싫어한다. 환경 설정은 반나절 동안 말하지 않아도 느려 죽을 지경이다.
/**
  * Created by Administrator on 2016/3/31.
  */

import org.apache.spark.{SparkConf, SparkContext}
/**
  * Created by Administrator on 2016/3/31.
  */
import scala.math.random

import org.apache.spark._
object simpleApp {
  def main(args: Array[String]) {
    val conf = new SparkConf().setAppName("Spark Pi").setMaster("local")
    val spark = new SparkContext(conf)
    val slices = if (args.length > 0) args(0).toInt else 2
    val n = math.min(100000L * slices, Int.MaxValue).toInt // avoid overflow
    val count = spark.parallelize(1 until n, slices).map { i =>
        val x = random * 2 - 1
        val y = random * 2 - 1
        if (x*x + y*y < 1) 1 else 0
      }.reduce(_ + _)
    println("Pi is roughly " + 4.0 * count / n)
    spark.stop()
  }
}

다음은 ibm 빅데이터 기반의 교육 자료를 공유합니다.
http://download.csdn.net/detail/wangyaninglm/9478412

좋은 웹페이지 즐겨찾기