Installing Scala

Installers are found at http://www.scala-lang.org/

IMPORTANT: you must also have installed Java, the runtime version 1.6 or newer. Java must be accessible via the PATH variable for your account. (See below to learn how to set PATH.)

Try your implementation by using Notepad to make a file named Hello.scala (please, not Hello.scala.txt) and place within the file the single line,

println("hello")
Then, open a command window and type scala Hello.scala. You should see hello print in the window. (If you do not and see instead, 'scala' is not recognized as a command or you see 'java' not recognized as a command, then you must manually set the PATH variable on your computer. See below.)

Scala development environment

You can install an IDE plug-in from the Scala page. Or, do your work with an ordinary text editor and a command window: Your development cycle is this:
Repeat until happy:
    - use text editor to edit your program,  s.scala
    - within the command window,  cd  to the folder where  s.scala  lives
        and type   scala s.scala   and watch what happens
You can also compile Scala programs and run them later; see the other reference materials.

Finding Scala and setting the PATH variable

Finding Scala and Java

It is probably the case that Scala is installed in the folder, C:\Program Files (x86)\scala\bin, and within that folder, there are programs named scala.bat and scalac.bat (or scala.exe...). The path to Scala is therefore C:\Program Files (x86)\scala\bin.

If you have no idea where Scala was installed on your computer, you must search for it:

  1. Press Start in the lower left corner of your display; press Search; in the search window, press all files and folders; in the top textline that appears, type scala.bat (or scala.exe); press the Search button.
  2. After several minutes, the folder where Scala is installed will be listed. Find that folder and open it and confirm that both scala and scalac are present.

Now, you must do the same steps to locate the path to java.exe. Let's say you found it at C:\Program Files (x86)\Java\jdk1.6.0_20\bin.

Setting a path in a command window

To use Scala within a command window, do this: Open a new command window and type the set path command:

set path=C:\Program Files (x86)\scala\bin;C:\Program Files (x86)\Java\jdk1.6.0_20\bin
This tells the command window to search the indicated paths for Scala and Java.

Now, type

path
You should see PATH=C:\Program Files (x86)\scala\bin;C:\Program Files (x86)\Java\jdk1.6.0_20\bin, confirming you have set correctly the lookup path. Now type
scala
You should see the start-up message for the Scala interpreter. You can do your work in this command window. Now, exit the interpreter. (Type :quit)

The permanent way to set the path

It is a annoying to set the path every time you open a command window, so you should reset permanently the value of the Windows OS PATH variable so that Windows knows once and for all the paths to Scala and Java. Here is what you must do on Windows 7 to reset the PATH variable:

  1. from the main menu, select Control Panel
  2. On the Control Panel window, set the upper right menu to "view small icons".
  3. Double click on the icon for System, and in the System window, click on Advanced system settings
  4. Click on the button Environment Variables
  5. In the new window, scroll the "System variables" until you see the variable, Path; click on it
  6. Press Edit
  7. Carefully use the right arrow button to move to the end of the long sequence of folder names. At the very end, without including any extra blanks, type the two paths (if they aren't there already, of course!):
    ;C:\Program Files (x86)\scala\bin;C:\Program Files (x86)\Java\jdk1.6.0_20\bin
    
Click "OK" multiple times, closing all the windows. Open a new command window, and type
path
Read carefully the printed path and confirm that you typed the paths correctly for Scala and Java. Now, whenever you open a new command window and type scala, and path is already known by Windows 7, and it finds and runs the program.