Book Image

Programming MapReduce with Scalding

By : Antonios Chalkiopoulos
Book Image

Programming MapReduce with Scalding

By: Antonios Chalkiopoulos

Overview of this book

Table of Contents (16 chapters)
Programming MapReduce with Scalding
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Hello World in Scala


To execute a Hello World application in Scala, we will use the latest version of Scala 2.10, the recommended JDK for Hadoop (Oracle JDK 1.6) and Maven. All we need is to add in our build tool a Scala library as a dependency and a plugin that compiles Scala:

<dependency>
  <groupId>org.scala-lang</groupId>
  <artifactId>scala-library</artifactId>
  <version>2.10.3</version>
</dependency>
...
<plugin>
  <groupId>net.alchim31.maven</groupId>
  <artifactId>scala-maven-plugin</artifactId>
  <version>3.1.6</version>
</plugin>

And the Scala source code:

object HelloWorld {
  def main(args: Array[String]) {
    println("Hello, world!")
  }
}

The preceding code can be executed with the following:

$ mvn package exec:java -Dexec.mainClass=HelloWorld