Hi. In this video, we are going to show you how to install the tools required for our class on your machine. This video is for people using Mac OSX. If you're using a different operating system, check the getting started section on the video lectures part of the class website. Everything that we show in this video is also explained in text on the Tools Set Up wiki page on the class website. So, let's have a look at this page. As you can see, there are three things that you need to install on your machine in order to prepare for this class. The first one is the JDK, the Java Runtime Environment, which is used to execute Scala programs. The second one is SBT, a build tool for Scala, which you will also use to submit your assignment solutions to Coursera. The third one is the Scala IDE for Eclipse, which is the IDE that we are going to use in this class. Okay, so, let's get started by installing the Java debug kit. Every section in this tutorial has three sub sections one for each operating system. Since we are currently on Mac OS10, we will look at how to install JDK on Mac OSX. In fact, Mac OSX either comes with Java pre-installed or it will install it automatically for you. To verify, if you already have Java, you have to open a terminal application. So, you open the Finder, we go to the Applications folder and we open the Utilities folder. In utilities, there's the application named terminal. Since we will be using the terminal a lot, in this class it makes sense to drag it into your dock. Okay, so we can close the Finder window, open a terminal. And now, we want to verify if we have Java installed. In order to do that, you type Java minus version into the terminal. On this machine I don't have Java installed yet. So, I will get the window which tells me, to open Java, I actually need to install it. So, the only thing you need to do is click the Install button. Of course, you have to agree to the license agreements. Okay. So, once the Java installation has finished, we just click Okay and we run Java minus version again. Now, we see the version number of the Java installation that has been installed. Okay. So, we close this terminal window and we move on to the second tool that we need to install. The second tool that we need to install is SBT. In order to install SBT on your system, you can either use the homebrew package manager or you can do a manual installation. In this video, I will do a manual installation. So, we download SBT from this URL. Once the download has finished, we navigate to the file in the Finder, and we double click it to extract SBT. Okay. So, since SBT is an application that we will reuse in the future, we will move it to a different location. So, I open a new Finder window, and in my home folder I create a subdirectory named applications. Now, I take the extracted SBT folder and I move it to my newly created Applications folder. Inside the SBT folder, you have a bin subdirectory, which contains the executable files for SBT. So, let's close the Finder window and go back to the tutorial. So, we downloaded SBT, we unpacked the Archive, and moved it to the Applications folder. And, and what we need to do last is adding the bin directory of SBT to the path environment variable. In order to do that, you have to open the file.bash<u>profile which is located in</u> your home directory. If the file doesn't exist yet, you will have to create it. Okay, so let's open a new Terminal window and lets check if the bash<u>profile file already exists.</u> So, we type ls.bash<u>profile. In my case, the file does no exist yet</u> but it might very well be that you already have it. So, in order to create or edit a file, we can use the Nano Text Editor, which is a very simple command-line text editor. We type, nano.ash<u>profile and hit</u> Enter. So now, we need to add one export command to dispatch profile file. We go back to the setup instructions, we copy the export command. Right click, Copy, and go back to the terminal, and paste it using right click Paste. Now, in fact, we have to change the path of our SBT installation to match the path were we actually extracted SBT. In my case, this was /users/luc, my username, /applications, and then SBT bin Now, we can exit the Nano text editor using Control+X, and we will save the changes to the file by confirming with Y and then hitting Enter for the file name. Okay, now, we need to verify if SBT has been installed correctly. We close the Terminal window and we go back to the instructions. In order to verify the SBT installation, we have to start a new Terminal window, and we have to type SBT-H. If the installation was successful, then you'll see SBT Help message appear on the screen. Okay, so, we close the Terminal window, we go back to the set up instructions and we go to the last tool that we have to install, the is Scala IDE four eclipse. In order to install this Scala IDE, we have to open this website and scroll down to the downloads. Now, you have to find the version of the Scala IDE which matches your operating system. In my case, I am on a 64-bit Mac OSX. So, I click this link. Once the download of the Scala IDE has finished, we open the Download folder in Finder. We unpack the Scala IDe by simply double clicking the file. Since, the Scala IDE is on applications that we will reuse in the future, we will also move it to our Applications folder. So, I open a new window, I go to my Applications folder, and then move the Eclipse folder into my applications. In order to open the Scala IDE, you simply go into the Eclipse folder and you double click the Eclipse file. When starting up Eclipse, you have to define which your, workspace you want to use. We recommend that you create one work space which you can then reuse for all the assignments of our class. I will do this now by clicking the Browse button and going to my home folder. Okay. So now, here I will create a new folder named ProgFun Workspace. I will select the folder and click Open. By clicking Okay, Eclipse will start up using that new workspace. Okay, in order to test the Scala IDE, we'll go back to the tool set of instructions page. We can close the Download page, and the Tool Setup page explains you to create a simple Hello World project in the Scala IDE. I will show you how to do this now. So, you go to Eclipse and in the menu , you select File, New Scalar Project. You give the project a name, for instance, Hello World. Okay. In order to enter the source code for the Hello World application, we have to create a new Scala object. So, we open a project, and we right-click on the Source folder, and select U Scala object. We give the object a name, in this case, Hello. And we define in which package job check we defined, so we put here the package greeter. We confirm by clicking Finish. Okay, now, the source code for the Hello World application can be found on the Tools Setup instructions. So, we go back to the wiki page and we scroll down to find the source code that we need. We select it, copy it, go back to Eclipse and just paste it into the file. We saved the file and, you can notice that once you save the file, Eclipse will automatically compile the entire project for you. In order to execute the Hello World application, you simply have to right click on the hello.scala source file, select Run S, and select Scala application. You will see the output of the Hello World program in the, in the eclipse console. The next feature that we are going to show you, is a brand new feature named the Scala worksheet. In a Scala worksheet, you can type arbitrary Scala expressions and see them evaluated on the fly. It's a great tool to learn and explore Scala. In order to create the worksheet, we right click on the Create Package, we select New Scala Worksheet. You have to give the worksheet a name, and click Finish to create it. Okay. I will increase the size of this window in order to see all the, all the worksheet. Now, to try out the worksheet, we have prepared some instructions for you that you can paste into this newly created object. So, if you go back to the set up instructions, and scroll down to the bottom of the page, you will see a few lines of code that you can copy and paste back in this freshly created Scala worksheet. Okay. Once you save to file, Eclipse will automatically evaluate at all the lines that are part of the worksheet and show the result of the evaluation on the right hand side. In this example, we assigned the number one to the value x. We define the function increase which returns its argument increase by one. Every test increase by invoking it and passing x into the function. You can see that increase of x returns two. Now, if you go back to Worksheet, and change the definition of x, for instance to be five, as soon as we save the file, the whole buffer will be reevaluated. And you can see that the result of the invocation of increase is now six.