Error: could not find or load the main class org.test.spark.streamExample

I tried to run an example of a basic implementation example in the Scala IDE, but I am getting below the error:

Error: Could not find or load main class org.test.spark.streamExample.

Can anyone help me figure this out.

+6
source share
8 answers

RightClick in your project and go to the properties where you will find the Scala Compiler, change the target to jvm 1.7 based on your installation, and also change the Scala drop-down list based on the installed version

+4
source

This error can occur for two reasons:

1. If you did not specify the main method in the scala program

def main(args: Array[String]): Unit = {
    println("TEst")
  }


2. scala

.

+1

scala , , , .

+1

, , - . .

, Scala POM Scala Scala

0

- . Scala, .

:

Project = > = > Scala = > Scala = > Scala. ( Scala. Scala, .)

0

IntelliJ IDE, IDE " ".

"Scala-console", " SDK ".

enter image description here

0

: , 1 , IDE (IntelliJ) JDK 11 JDK 8, , ,

:

spark-core spark-sql build.sbt Paackage

1).

libraryDependencies + = "org.apache.spark" %% "spark-core"% "2.4.0"

2).

libraryDependencies + = "org.apache.spark" %% "spark-sql"% "2.4.0"

https://mvnrepository.com/artifact/org.apache.spark/spark-core_2.12/2.4.0

https://mvnrepository.com/artifact/org.apache.spark/spark-sql_2.12/2.4.0

0

:

Step 1: Application built from sbt

Step 2: import the application into Eclipse.

Step 3: When starting the application, the following error appeared

1

Decision

In the problem tab, if we see the following error

2

sbt used scala 2.11, and in eclipse we set scala to 2.12. So if we install the version of the eclipse scala compiler on 2.11, it will work as shown below

3

Please check this feature.

0
source

Source: https://habr.com/ru/post/1621216/


All Articles