-
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. If you do not know which version of Windows you have, see below under Windows 10 users.
-
After you download the .dmg (Mac) or .exe (Windows), double-click it to start the installation. Click as needed to complete the installation. Do not try to change the location Java gets installed to. Just let the installer put Java where it likes.
-
I am assuming you have deleted all copies of Java from your computer by using the special Java uninstall tool for Windows here. If not, you can give these instructions a try, but if they don't work come back and do this.
-
If you didn't know which version of Java to install in Part 4, determine whether you have 64 bit (x64)or 32 bit (x86) Windows by following the directions for Windows 10 here. Then download and install the SDK (make sure it’s the SDK!) from here again making sure to select x64 or x86 depending on your system. Do not try to change the location Java gets installed to. Just let the installer put Java where it likes.
-
Quit any cmd terminals you have open, and quit Atom.
-
Just repeating this here: quit any cmd terminals you have open and quit Atom.
-
Make sure that you have the path to the Java sdk bin directory exactly right as follows: (a) navigate in your file system (using Explorer, or whatever it’s called in Windows) to the location where the Java
bin
folder was installed (e.g.,C:\Program Files\Java\jdk1.8.0_201\bin
). MAKE SURE IT'S JDK and not JRE!!! (b) Right-click on the\bin
fodler and chooseProperties
. (c) The path is shown next to the Location header, which you must now highlight and copy. -
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 paste in what you copied in step 5. If it does not end in\bin
then add\bin
to the end, e.g.,C:\Program Files\Java\jdk1.8.0_201\bin
. Make sure it has\bin
. Make sure it does not havejre
in it. Onyljdk
will work. -
Look at the rest of the entries in the path variable. If you see any entry with the word "java" or "Java" or "jre" in it anywhere at all, delete that entry.
-
Save and close that window. Look in the list of environment variables, and if you see a JAVA_HOME variable in your environment variables, delete it.
-
Open a CMD shell by clicking the
Start
button, then selectingWindows System -> Command Prompt
. -
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. Try following the instructions more carefully.
-
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!