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

How to display web pages properly in various resolutions and browsers

The key codes are as follows: Copy code The code i...

VMware ESXi 5.5 deployment and configuration diagram process

Table of contents 1. Installation requirements 2....

ffmpeg Chinese parameter description and usage examples

1. When ffmpeg pushes video files, the encoding f...

What is Software 404 and 404 Error and what is the difference between them

First of all, what is 404 and soft 404? 404: Simpl...

MySQL NULL data conversion method (must read)

When using MySQL to query the database and execut...

TypeScript decorator definition

Table of contents 1. Concept 1.1 Definition 1.2 D...

Front-end state management (Part 1)

Table of contents 1. What is front-end state mana...

MySQL 8.0.12 installation and configuration graphic tutorial

Recorded the download and installation tutorial o...

How to use nginx to configure access to wgcloud

The nginx configuration is as follows: Such as ht...

Two tools for splitting the screen in the Linux command line terminal

Here are two terminal split screen tools: screen ...

Share some tips on using JavaScript operators

Table of contents 1. Optional chaining operator [...

js to realize automatic lock screen function

1. Usage scenarios There is such a requirement, s...