错误:无法找到或加载主类com.sundogsoftware.spark.RatingsCounte

问题描述 投票:0回答:1

我不知道这里有什么问题。当我运行时,我在scala IDE中不断收到“错误:无法找到或加载主类com.sundog software.spark.Ratings Counter”。

这是我的scala代码

package com.sundogsoftware.spark

import org.apache.spark._
import org.apache.spark.SparkContext._
import org.apache.log4j._

/** Count up how many of each star rating exists in the MovieLens 100K 
data set. */
object RatingsCounter {

/** Our main function where the action happens */
def main(args: Array[String]) {

// Set the log level to only print errors
Logger.getLogger("org").setLevel(Level.ERROR)

// Create a SparkContext using every core of the local machine, named RatingsCounter
val sc = new SparkContext("local[*]", "RatingsCounter")

// Load up each line of the ratings data into an RDD
val lines = sc.textFile("../ml-100k/u.data")

// Convert each line to a string, split it out by tabs, and extract the third field.
// (The file format is userID, movieID, rating, timestamp)
val ratings = lines.map(x => x.toString().split("\t")(2))

// Count up how many times each value (rating) occurs
val results = ratings.countByValue()

// Sort the resulting map of (rating, count) tuples
val sortedResults = results.toSeq.sortBy(_._1)

// Print each result on its own line.
sortedResults.foreach(println)
 }
}

这是我的项目结构

enter image description here

这是我的运行配置

enter image description here

这是我选择的scala编译器选项。

enter image description here

现在尝试调试这几个小时,似乎没有任何工作。

任何指针都会有所帮助。

scala scala-ide
1个回答
1
投票

查看https://wiki.eclipse.org/Eclipse.ini我必须在我的eclipse.ini文件中更改vm arg,对于我的JRE选项,我在创建scala项目时选择了“使用默认JRE(当前'Java SE 8 [1.8.0_172]')'。这为我修复了这个错误。

我使用OS X,所以我不得不添加

-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/bin/java

以上-vmargs

© www.soinside.com 2019 - 2024. All rights reserved.