Note: This study originates from: DT Big Data DreamWorks (public number: Dt_spark)
1. Download the Scala installation package First:
For subsequent spark Learning, we need to choose version:2.10.4
Http://www.scala-lang.org/download/2.10.4.html
2. After installation, choose the Scala IDE, one is the Eclipse Scala IDE, the other is Intellij idea
Because of personal preference for Intellijidea, take Intellij idea as an example.
3 . Use of idea
① New Model
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/24/wKioL1Wy7I7A_Ck1AAHQc7s2EOs361.jpg "title=" 1.png " alt= "Wkiol1wy7i7a_ck1aahqc7s2eos361.jpg"/>② Choose Scala
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/24/wKioL1Wy7KzjwpmRAAGWqmCP_ys071.jpg "title=" 2.png " alt= "Wkiol1wy7kzjwpmraagwqmcp_ys071.jpg"/>③ Create Project
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/27/wKiom1Wy6tiCham-AAGSm_66QP4681.jpg "title=" 3.png " alt= "Wkiom1wy6ticham-aagsm_66qp4681.jpg"/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/24/wKioL1Wy7O_zxj0TAAD50I3lc4Y415.jpg "title=" 4.png " alt= "Wkiol1wy7o_zxj0taad50i3lc4y415.jpg"/>
④ClickSRC,PressAlt + Insert, first create Package, and then createScala Class
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/27/wKiom1Wy6xGRhgLHAAFGIw2NhXc042.jpg "title=" 5.png " alt= "Wkiom1wy6xgrhglhaafgiw2nhxc042.jpg"/>
⑤ when you create a Scala class , select the Object
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/24/wKioL1Wy7QbA-4SHAACpuLm0Nug088.jpg "title=" 6.png " alt= "Wkiol1wy7qba-4shaacpulm0nug088.jpg"/>
4. Write the first HelloWorld program
Package Com.td.scala.hello/** * 1th Lecture: HelloWorld * Created by limin on 2015/7/24. */object Helloscala {def main (args:array[string]): Unit = {println ("Hello Scala!!! A New world! ") for (Arg <-args) println (ARG)}}
Run:
Result:Hello Scala!!! A New world!
You can also customize incoming values:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/27/wKiom1Wy6yzgwy2lAAHghpAAS0Q981.jpg "title=" 7.png " alt= "Wkiom1wy6yzgwy2laahghpaas0q981.jpg"/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/24/wKioL1Wy7SqCMdPnAALCsmCIJ5U601.jpg "title=" 8.png " alt= "Wkiol1wy7sqcmdpnaalcsmcij5u601.jpg"/> run output value:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/27/wKiom1Wy61ei0ykbAADiZJfakQk580.jpg "title=" 9.png " alt= "Wkiom1wy61ei0ykbaadizjfakqk580.jpg"/>
Resources:
DT Big Data Dream Factory public number: Dt_spark
This article is from "My Heart Flying" blog, please make sure to keep this source http://10562836.blog.51cto.com/10552836/1678247
Scala Learning Review (i)----Scala's environment building