';'预期但找到“导入"-Scala和Spark [英] ';' expected but 'import' found - Scala and Spark

查看:123
本文介绍了';'预期但找到“导入"-Scala和Spark的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Spark和Scala编译一个独立的应用程序.我不知道为什么会收到此错误:

I'm trying to work with Spark and Scala, compiling a standalone application. I don't know why I'm getting this error:

topicModel.scala:2: ';' expected but 'import' found.
[error] import org.apache.spark.mllib.clustering.LDA
[error] ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed

这是build.sbt代码:

This is the build.sbt code:

name := "topicModel"

version := "1.0"

scalaVersion := "2.11.6"

libraryDependencies += "org.apache.spark" %% "spark-core" % "1.3.1"
libraryDependencies += "org.apache.spark" %% "spark-graphx" % "1.3.1"
libraryDependencies += "org.apache.spark" %% "spark-mllib" % "1.3.1"

这些是进口:

import scala.collection.mutable
import org.apache.spark.mllib.clustering.LDA
import org.apache.spark.mllib.linalg.{Vector, Vectors}
import org.apache.spark.rdd.RDD

object Simple {
  def main(args: Array[String]) {

推荐答案

这可能是因为您的文件具有旧的Macintosh行结尾(\ r)?

This could be because your file has old Macintosh line endings (\r)?

请参见这些导入后为什么需要分号?了解更多信息.

这篇关于';'预期但找到“导入"-Scala和Spark的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆