Installing

I’ll assume you’ve downloaded the binary distribution of Scala and also have verified your Java installation. The installation steps vary depending on the platform you’re on—refer to the relevant section.

Installing Scala on Windows

On Windows, the msi package nicely walks us through the installation steps; follow along with the instructions as they appear during installation. Choose the appropriate location to place the Scala binaries. If you have no particular location preference I suggest placing the distribution under C:programsscala directory. Choose a directory name with no whitespace in it, since path names with whitespace often cause trouble.

Let’s make sure the setup went as expected. Close any open command-line windows because changes to the environment variables won’t take effect until you reopen the windows. In a new command-line window, type scala -version, and make sure it reports the right version of Scala you just installed. If you got that working, you’re all set to use Scala!

Installing Scala on Unix-like Systems

There are a couple of options to install Scala on Unix-like systems. On Mac OS X, you can use brew install scala. On other flavors of Unix-like systems, use the appropriate installation or package manager.

Alternately, directly download the distribution file and untar it. Move the unbundled directory to the appropriate location. For example, on my system, I copied the unbundled directory to the /opt/scala directory. Finally, set up the path to the bin directory of the Scala distribution.

As a final step, let’s run Scala to ensure the setup went smoothly. Technically, we can source the profile file to bring in the changes to the environment variables, but it’s less trouble to open a new terminal window. In it, type scala -version, and ensure it reports the version of Scala you expect. Now you’re all set to use Scala!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.201.47