Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

DT big data DreamWorks-Scala Learning Notes (1): Scala Development Environment Construction and HelloWorld Analysis

Shulou Source: shulou.com Published: 2022-06-03 03:47:41 09月11日 Update

First, scala is a combination of functional programming and object-oriented programming. What are the characteristics of these two kinds of programming?

A: functional programming is good at numerical calculation; object-oriented programming is especially suitable for the organization of large projects or projects, as well as the division of labor and cooperation among teams.

Second, the characteristics of Scala

Scala is elegant in structure, exquisite in calculation and expressive.

What resources are needed for the installation of scala?

Java, it is recommended to install Java8 (Java7 is also possible)

Support scala 2.10.* or above (2.10.4, http://scala-lang.org/download can be installed)

4. Set environment variable (system variable):

(1) JAVA_HOME and SCALA_HOME

Determine the installation directory where JAVA and SCALA have been added (variables are C:\ Program Files\ Java\ jdk1.7.0_71 and C:\ Program Files (x86)\ scala, respectively)

(2) PATH

Make sure that% JAVA_HOME%\ bin and% SCALA_HOME%\ bin in the installation directory have been set in the variable value.

After adding SCALA's bin directory to PATH, use the SCALA command in any directory

(3) CLASSPATH

Add% JAVA_HOME%\ lib\ dt.jar;%JAVA_HOME%\ lib\ tools.jar to the variable value

5. View the version of the command:

Java-version

Scala

Use IDE integrated development environment to operate

1. IDEA, the first is IDEA. When developing Spark big data, IDEA is used to develop.

Because it supports JAVA and SCALA very well, and other supports are very good.

2. ScalaIDE (for eclipse), download, decompress and use it.

Beginners are strongly recommended to use ScalaIDE (for eclipse)

7. Establish the first procedure:

1. Create a project

Named: ScalaInAction

2. Create a package in the source code (easy to manage)

Set up packet under src

Named: com.dt.scala.hello

3. Create an object (after creating a package, you can write a program in it)

Named: HelloScala

Check "public static void main (String [] args)"

(Scala Object is a static object in the Scala class, and we have the main method entry of Scala in Scala Object)

Run As

The information comes from: DT big data DreamWorks Wechat Public account: DT_Spark

Tags: Programming objects directories development values support data environment functions variables commands engineering features programs recommendations factories elegance information portals public Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS OPPO Reno Linux MariaDB Huawei