You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Ashok Kumar <as...@yahoo.com.INVALID> on 2016/02/16 02:24:18 UTC

How to run Scala file examples in spark 1.5.2

 Gurus,
I am trying to run some examples given under directory examples
spark/examples/src/main/scala/org/apache/spark/examples/
I am trying to run HdfsTest.scala 
However, when I run HdfsTest.scala  against spark shell it comes back with error
Spark context available as sc.
SQL context available as sqlContext.
Loading HdfsTest.scala...
<console>:19: error: illegal start of definition
       package org.apache.spark.examples
       ^
import org.apache.spark._
defined module HdfsTest
scala>
Can someone guide me how to run these Ccala codes without errors?  Do I need to compile them first with scalac -cp $CLASSPATH HdfsTest.scala  
Thanking you

Re: How to run Scala file examples in spark 1.5.2

Posted by Ted Yu <yu...@gmail.com>.
If you don't modify HdfsTest.scala, there is no need to rebuild it - it is
contained in the examples jar coming with Spark release.

You can use spark-submit to run the example.

Cheers

On Mon, Feb 15, 2016 at 5:24 PM, Ashok Kumar <as...@yahoo.com.invalid>
wrote:

> Gurus,
>
> I am trying to run some examples given under directory examples
>
> spark/examples/src/main/scala/org/apache/spark/examples/
>
> I am trying to run HdfsTest.scala
>
> However, when I run HdfsTest.scala  against spark shell it comes back with
> error
>
> Spark context available as sc.
> SQL context available as sqlContext.
> Loading HdfsTest.scala...
> <console>:19: error: illegal start of definition
>        package org.apache.spark.examples
>        ^
> import org.apache.spark._
> defined module HdfsTest
>
> scala>
>
> Can someone guide me how to run these Ccala codes without errors?  Do I
> need to compile them first with scalac -cp $CLASSPATH HdfsTest.scala
>
> Thanking you
>