官方网站 https://www.scala-lang.org/
image.png
下载JDK配置JAVA1.8以上开发环境
$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
下载Scala下载地址 https://www.scala-lang.org/download/
image.png
$ scala -version
Scala code runner version 2.12.8 -- Copyright 2002-2018, LAMP/EPFL and Lightbend, Inc.
https://github.com/scala/scala/releases
javac -version
on the command line and make sure you seejavac 1.8.___
image.png
image.png
src
and select New => Scala class. If you don’t see Scala class, right-click on HelloWorld and click on Add Framework Support…, select Scala and proceed. If you see Error: library is not specified, you can either click download button, or select the library path manually.Hello
and change the Kind to object
.object Hello extends App {
println("Hello, World!")
}
$ scala
Welcome to Scala 2.12.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_121).
Type in expressions for evaluation. Or try :help.
scala> var x = 1
x: Int = 1
scala> :q
选择org.scals-tools.archetypes:scala-archetype-simple
image.png
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>