Build a Scala environment under Linux and write a simple Scala program

Build a Scala environment under Linux and write a simple Scala program

It is very simple to install Scala environment in Linux. If it is Ubuntu environment, it is even simpler. Just use apt-get to get it done. I use Ubuntu. Java/Scala system needs to be based on JDK, so JDK must be installed first.

1. Installing JDK is a commonplace and not worth mentioning.

2. Install Scala, as follows:

sudo apt-get install scala

as follows:

ubuntu@VM-0-15-ubuntu:~/taoge/scala$ scala -version
Scala code runner version 2.11.6 -- Copyright 2002-2013, LAMP/EPFL
ubuntu@VM-0-15-ubuntu:~/taoge/scala$

Of course, you can also use the Scala shell, as follows:

ubuntu@VM-0-15-ubuntu:~/taoge/scala$ scala
Welcome to Scala version 2.11.6 (OpenJDK 64-Bit Server VM, Java 1.8.0_151).
Type in expressions to have them evaluated.
Type :help for more information.
scala>

OK, let's write a Scala program to test it:

ubuntu@VM-0-15-ubuntu:~/taoge/scala$ cat test.scala 
object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, world!")
  }
}
ubuntu@VM-0-15-ubuntu:~/taoge/scala$ scala test.scala 
Hello, world!
ubuntu@VM-0-15-ubuntu:~/taoge/scala$

Spark is written in Scala, so it is necessary to know some Scala.

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • How to configure IDEA to use the Maven Helper plugin (detailed configuration)
  • Getting Started Tutorial on Configuring Tomcat Using IntelliJ IDEA
  • Detailed explanation of configuring Maven with IntelliJ IDEA (beginner's guide)
  • Use IDEA to configure Maven to build a development framework ssm tutorial
  • Tutorial on setting up Scala environment and configuring and using IDEA tool

<<:  Example of implementing skeleton screen with Vue

>>:  MySql 5.7.20 installation and configuration of data and my.ini files

Recommend

Detailed explanation of the background-position percentage principle

When I was helping someone adjust the code today,...

JS native 2048 game source code sharing (the latest on the Internet)

I have been learning about algorithms recently an...

About dynamically adding routes based on user permissions in Vue

Display different menu pages according to the use...

Linux system MySQL8.0.19 quick installation and configuration tutorial diagram

Table of contents 1. Environment Introduction 2. ...

Detailed explanation of how to install MariaDB 10.2.4 on CentOS7

CentOS 6 and earlier versions provide MySQL serve...

Solve the problem that the docker container cannot ping the external network

Today, when I was building a redis environment in...

MySQL select, insert, update batch operation statement code examples

In projects, batch operation statements are often...

HTML form tag usage learning tutorial

Forms in HTML can be used to collect various type...

Tools to convert static websites into RSS

<br /> This article is translated from allwe...

Vue implements video upload function

This article example shares the specific code of ...

MYSQL transaction tutorial Yii2.0 merchant withdrawal function

Preface I am a PHP programmer who started out as ...

CSS Viewport Units for Fast Layout

CSS Viewport units have been around for the past ...

How to use filters to implement monitoring in Zabbix

Recently, when I was working on monitoring equipm...

Introduction to local components in Vue

In Vue, we can define (register) local components...

Use Grafana+Prometheus to monitor MySQL service performance

Prometheus (also called Prometheus) official webs...