Error while running reduceByKey example to calculate daily revenue - scala code on intellij

I am getting below error while run or debuggng the scala code discussed in “Big Data WorkShop 9 video”
The code works fine when I run it in SBT console mode.

Connected to the target VM, address: ‘’, transport: ‘socket’
Disconnected from the target VM, address: ‘’, transport: ‘socket’
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/spark/SparkConf
at DailyRevenue$.main(DailyRevenue.scala:12)
at DailyRevenue.main(DailyRevenue.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.SparkConf
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
… 2 more

Process finished with exit code 1

Can you please help debug and resolve this issue.


Refer this link

Thanks Selvag

I tried to change the project structure -> module as suggested in the stackoverflow but I am still getting the same error message.



Thanks Selva for guiding me, I was able to resolve the issue now.

Steps that resolved this issue:

  1. removed provided from my build.sbt
  2. explicitly selected the JRE in class path (under edit configuration)