You have to include Scala libraries in the Eclipse dependencies.

TD

On Tue, Mar 10, 2015 at 10:54 AM, Mohit Anchlia <mohitanch...@gmail.com>
wrote:

> I am trying out streaming example as documented and I am using spark 1.2.1
> streaming from maven for Java.
>
> When I add this code I get compilation error on and eclipse is not able to
> recognize Tuple2. I also don't see any "import scala.Tuple2" class.
>
>
>
> http://spark.apache.org/docs/1.2.0/streaming-programming-guide.html#a-quick-example
>
>
> *private* *void* map(JavaReceiverInputDStream<String> lines) {
>
> JavaDStream<String> words = lines.flatMap(
>
> *new* *FlatMapFunction<String, String>()* {
>
> @Override *public* Iterable<String> call(String x) {
>
> *return* Arrays.*asList*(x.split(" "));
>
> }
>
> });
>
>  // Count each word in each batch
>
> JavaPairDStream<String, Integer> pairs = words.*map*(
>
> *new* *PairFunction<String, String, Integer>()* {
>
> @Override *public* *Tuple2*<String, Integer> call(String s) *throws*
> Exception {
>
> *return* *new* *Tuple2*<String, Integer>(s, 1);
>
> }
>
> });
>
>  }
>

Reply via email to