It is important that you follow all the directions perfectly. Things do not work unless you follow all the directions.
If you encounter an error message, please see the problems.md file in this repository before emailing the instructor.
If you experience problems with git or GitHub, use the GitHub Desktop app to complete this problem set.
-
You might already have some components of Java installed on your computer. Unless you have a very good reason for keeping other versions of Java around, we recommend that you uninstall all existing versions of Java from your computer (instructions: Mac, Windows).
-
Although there are several newer versions of Java, we'll be using Java 8. Download the Java SE Development Kit 8u191 (the last three numbers might be different, that's okay!) for your operating system from here. Don't forget to click the radio button indicating that you agree to the terms of the license.
-
After you download the .dmg (Mac) or .exe (Windows), double-click it to start the installation. Click as needed to complete the installation.
-
Launch
Control Panel -> (Optional) System and Security -> System
. -
Click
Advanced system setting
in the left pane. -
Select the
Advanced
tab, and clickEnvironment Variables
button. -
Under
System Variables
(the bottom pane), the scroll down to selectPath
, then selectEdit...
. -
In Windows 10, you will see a table listing all the existing
PATH
entries. ClickNew
then enter the JDK'sbin
directory, which should bec:\Program Files\Java\jdk-1.8.{x}\bin
, where{x}
is replaced with the version number you installed in Part 4, Step 2, above. You can determine exactly what it is by looking in that directory calledJava
. Then SelectMove Up
to move this entry all the way to the top of the table. -
Delete all other references to Java in the path.
-
Delete the JAVA_HOME environment variable, if you find it.
-
Open a CMD shell by clicking the
Start
button, then selectingWindows System -> Command Prompt
. -
Type
path
at the prompt, and you should see output that begins like this, where again the {x} is the exact version you installed from Oracle in Part 4, Step 2.
PATH=c:\Program Files\Java\jdk-1.8.{x}\bin;
- Type
java -version
and you should see something like this:
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
- Type
javac -version
and you should see something like this:
javac 1.8.0_191
- If you get an error message (e.g., "command java not found") or if the numbers are different (e.g., java 1.7...), then something is not right. Go to the problems file in this repository.
-
Launch a Terminal. You can do this by finding the Terminal app in your Applications folder, or by going up to the magnifying glass in the upper right corner of your screen and then searching for Terminal.
-
At the prompt in Terminal, type
java -version
and you should see something like this:
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
- Type
javac -version
and you should see something like this:
javac 1.8.0_191
- If you get an error message (e.g., "command java not found") or if the numbers are different (e.g., java 1.7..., java 10...), then something is not right. Email the instructor and the TAs.
If you have never used Java before, I recommend that you use Atom to write and compile your code for this class. If you have used IntelliJ or Eclipse or another IDE in the past for Java development, you can continue to do so, but I will provide support only for Atom. If you decide to use Atom, follow these instructions to install and configure Atom.
-
Download Atom. Double click the downloaded file to unzip it (if necessary), then move Atom out of your Downloads folder to a place on your computer where it will be easy to find (e.g., in the Applications folder or on your desktop).
-
Launch Atom. There are a few tabs or frames that open automatically, which you can close by clicking the "X" in the upper right corner of the tab or frame. (If all these windows keep popping up when start Atom, you can disable them.)
-
You now need to install an Atom package that will customize Atom for use in this class. From Atom's menu bar, click the Atom menu, and then select Preferences to open the Settings menu.
- On the left of the Settings area, you’ll see a menu with items like Core, Editor, URI Handling, and so on. Click on the menu item that says Install, which has a plus-sign icon next to it.
- In the search box that appears, enter
platformio-ide-terminal
. Click Install button forplatform-ide-terminal
, and wait for installation to complete.
We will be using git and GitHub to distribute and collect problem sets. Using GitHub is not optional. GitHub and git are used by millions of software developers at major companies around the world. An important component of this class and of your development as a computer scientist is understanding how to use git and GitHub.
-
Start by creating a folder on your computer for this class called
CS2
orCS1102
. I have mine on my Desktop so it's easy to find, but you are free to put it wherever is convenient for you. -
Look up at the top of this webpage you are on right now, and locate the green
Clone or download
on the right. Click that button, and then copy the the URL beginning withhttps://
that appears, which will look something like this, below:
-
In Atom, go to
Packages -> Command Palette -> Toggle
. -
In the pop-up window that opens, start typing
GitHub
, and the GitHub: commands will appear. SelectGitHub: Clone
. -
Paste the URL from Part 1 in the first box, and the path to the course folder you created to Part 1 followed by the name of your respository in the second box. Here's what the box looks like on my computer. You can see that the repository URL ends in
ps1.git
, while the destination directory ends inps1
. Yours will look similar, except the repository URL will end inps1-yourusername.git
, and you should choose a directory on your computer that ends inps1-yourusername
.
- Click the
Clone
button. This will copy your personalps1-yourusername
repository to your computer. If you get an error message in red letters, you are probably not following the directions, so try again!
NOTE: If you end up with an empty repository following these instructions, use the GitHub Desktop app to do your cloning and your other GitHub activities, as needed. You are free to use the GitHub Desktop application for this class.
-
If you did Part 7 correctly, you should see the contents of the repository in Atom. If you can't see the
ps1-yourusername
repository, then go toFile -> Open
, and navigate to your class folder, where you should find your local respoitory. Selectps1-yourusername
and clickOpen
. Do not select your class folder or thesrc
folder! -
You should now see something like this, below, with a tree structure showing the files in your current directory in the left pane and an empty pane on the right. (Feel free to close any of the pesky Welcome tabs and panes that Atom likes to open up.)
- Click on
src
to view the code for this assignment, then click onHelloWorld.java
. Code will appear in the panel on the right. Find where you see this in the code:
System.out.println("Hello, World!")
Replace the words Hello, World!
with your favorite greeting.
-
From the
File
menu, selectSave
(or use your usual keyboard shortcut for saving, like command-s in MacOS or control-s in Windows). -
Go to
Packages -> GitHub -> Toggle Git Tab
. -
The Git tab will open, and you'll see something like this, below. Click
Stage all
.
-
Type a comment explaining what you did and why where it says
Commit message
. -
Click
Commit to master
. -
Click the
Push
on the right in the bottom menubar, betweenmaster
andfiles
. This is the part people always forget, so don't forget! -
Go to GitHub and confirm that your respository has been updated. You should see the changes reflected in your problem set repository and see
last updated 1 minute ago
(or thereabouts). This is what we will grade. Congratulations!