Hello I have this scala object and I want to run the code in sample function using the shell with scala:
object SampleObject{
def sample(){
val data = Array(1, 2, 3, 4, 5)
data.foreach(println(_))
}
}
What I do is this
scala> :load /Users/username/Desktop/Cli.scala
Loading /Users/username/Desktop/Cli.scala...
defined object SampleObject
But if I run this
scala> SampleObject.sample
This is what I ge this
<console>:92: error: value sample is not a member of object SampleObject
SampleObject.sample
Why does this happen? There's a problem with the commands :load and -i, it's like you can't access to the objects members. Any suggestion to make it work?
UPDATE1: If I run the code above neither doing load or -i but by writing it directly on the shell everything works properly.

sbt console-iand:load) Meaning there is something else going wrong here. What Spark version do you use? What jdk version are you using as well?