Scala installation and use (Windows)

1. Download and install scala-2.12.12.msi



Scala can be installed on any UNIX/Linux-based or Windows-based system. Before you can start installing Scala on your machine, you must have Java 1.8 or later installed on your machine.

This experiment is to build a development environment on the windows platform, so it is necessary to install the Java software development kit (SDK) on the windows system first. To verify that Java is installed, execute the following command:

To view the java version number: java -version

 

1: Download the Scala operating environment, which can be downloaded through the public network, or through the platform’s shared resource download address: scala-2.12.12.msi

Download path of the public network:
https://www.scala-lang.org/download /2.12.12.html

 

2. Run and install the scala-2.12.12.msi file:




 

 Successful installation step by step:

3. Start the command line window on the window and run: scala.
        

2. Start configuring the idea plugin



Start IDEA and set up the plug-in:

1. Search for the scala plug-in, and click the install button to complete the download and installation:

You can also download the plug-in locally through the download address and install it:
https://plugins.jetbrains.com/plugin/1347-scala/versions

Restart IDEA after the plug-in is successfully installed:

3. Start creating a Scala project

        
1. Create a Maven project:

 

 2. Add project support to the project:

 

 

3. Select Scala project support and specify the installation path of Scala:

  

4. Add the scala directory under the main directory
 

5. Set scala as the project root path

 

6. Add Scala Class in the scala directory:

 

Enter my first Scala code:

object HelloWorld {
def main(args: Array[String]) = {
val a = 10
val b=20
val c=a+b
println("helloWorld!"+c)
}
}


 

 

4. Start the HelloWorld code:


1. Run the scala code:

 

2. View the output results:

This experiment is complete!
 

Guess you like

Origin blog.csdn.net/qq_56520755/article/details/130553538