Lab 1b: Setting Up Your Computer

Installing Java

  1. You'll need to install Java 1.7 in order to compile your code in this class. You can do that by downloading the Java 1.7 JDK from Oracle. Oracle Website
  2. Scroll down until you find the download section for Java SE 7u75/76 and click the Download button for the JDK. Java JDK
  3. On the following page, find the download section entitled "Java SE Development Kit 7u75" and agree to the license. Then proceed to download the binary file for your operating system. Java Agreement
  4. Run the install file and follow the prompts to install Java onto your computer.

A. Windows Setup

  1. First, install Java using the instructions provided under the Installing Java section. Downloading the JDK should also provide javac, a Java compiler on the Command Interpreter.
  2. In CS 61B, we'll be using python to compile more complicated projects, so download and install it from here.
  3. Update your environment variables.

    1. Windows 8/8.1: Launch the Start Screen by pressing Windows, and type 'Environment Variables'. Select "Edit the system environment variables".

      Windows 8.1 Search

      Windows 7 and earlier: Open the Start Menu and launch the "Control Panel". Search for "Environment Variables", and select "Edit the system environment variables".

      Windows 7 Control Panel

    2. Navigate to the "Advanced" tab, and click "Environment Variables...".

      System Properties

    3. Under "System variables", click "New..."

      System Variables

    4. Define the following variables — if the variable already exists, select the variable and click "Edit...", then add the value specified below to the front of the value, followed by a semicolon; otherwise, click "New..." and use the values specified below as the value of the variable:

      • JAVA_HOME: Set this to the location which you installed Java, for instance, C:\Program Files\Java\jdk1.7.0_51 in my case.

        Define Environment Variable

      • PYTHON_HOME: Set this to the location which you installed Python, for instance, C:\Python33 in my case.
      • PATH: Add %JAVA_HOME%\bin; %PYTHON_HOME%; to the beginning of the value of this variable.
  4. Lastly, we'll need to install git, the main tool for this class. Head over here and grab Git for Windows. When you are installing the program, make sure 'Windows Explorer integration' is checked. Note: It is recommended to select 'Advanced context menu', which will include both Git Bash and Git GUI (this allows you to make use of additional Git features when you right-click files).

    Git Installation

  5. To access git, look for Git Bash within your All Programs folder. If you're using Windows 8, then you can find it by pressing Windows + s and type 'Git' or finding it within the Apps menu.

Congratulations, you have successfully installed Git Bash into your Windows machine.

B. OS X Setup

  1. First, install Java using the instructions provided under the Installing Java section. Downloading the JDK should also provide javac, a Java compiler on the terminal.
  2. Install Homebrew, a very easy to use package manager. To install, go to your Terminal and enter the following:

    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  3. Then, check to make sure brew is working properly on your system by typing:

    $ brew doctor

    You may encounter warnings like this, but you should be fine. Proceed to the next step. Homebrew Warnings

  4. If you encounter a warning asking you to download Command Line Tools, you will need to do this. Please follow the StackOverflow post here. It's very important to have gcc installed onto your computer in order to build and install tools to aid you in your computer science career.
  5. Install python3 and git. You can do this by typing:

    $ brew install git
    $ brew install python3

C. Unix and Linux Setup

  1. If you are using a Linux/Unix distro, use your package manager (apt-get, yum, etc) to install java 1.7 JDK, python3, and git.

First, check to see if Java is already installed by typing:

    $ java -version

If you see "The program java can be found in the following packages" or something similar, Java has not been installed yet. You can install java by typing:

    $ sudo apt-get install openjdk-7-jdk

To install python3:

    $ sudo apt-get install python3

To install git:

    $ sudo apt-get install git