About
Getting started page with an HelloWorld example and some documentation.
Hello World
- Create a main HelloWorld object: Scala - Main (Top-Level Objects)
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
- Run it interactively: Scala - Console (Interactive Shell|REPL)
- Compile it: Scala - Compiler (scalac)
- Run the compile code: Scala - Scala Command (Execute Bytecode)
Maven
In a maven project, you need to add the lang library
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
but there is other library:
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-actors</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang.modules</groupId>
<artifactId>scala-parser-combinators_${scala.binary.version}</artifactId>
<version>1.0.4</version>
</dependency>
where:
<properties>
<scala.binary.version>2.11</scala.binary.version>
<scala.version>2.11.8</scala.version>
</properties>