This document describes the procedure to set up your Microsoft Windows computer for Java development and for submitting the course assignments using git.
The first step is to install the Java Software Development Kit (SDK). You may already have a Java Runtime Environment (JRE) if other applications on your system require it, but that is not enough. Unless you have programmed in Java on this system before, chances are you’ll need to install a JDK from scratch.
Start at this link: http://www.oracle.com/technetwork/java/javase/downloads/index.html
where you will find a menu of Java SE (Standard Edition) downloads.
Choose Java Platform (JDK) – the latest version as I’m writing this is 7u11.
On the next page, you’ll need to accept the license agreement, and then you can find the .exe
file for your platform, either Windows x86 (32-bit OS) or x64.
How to determine if you are using 32- or 64-bit Windows: From the Windows start menu, choose Control Panel » System and Security » System, and look for the System type.
I usually recommend saving the installer and then running it, so that it’s easy to find in your Downloads folder if you get interrupted or need to reinstall.
Go through the Oracle setup wizard; all the defaults are fine.
At this point you may be redirected to a web browser to register with Oracle. That is completely optional.
Git is a distributed version control tool used by many software developers. In this course, you will use it to submit your work. Using git, I can distribute recommended changes back to you, and my server will keep track of all versions of your work that it ever sees.
Git can be difficult to master, but I will provide recipes for the common cases we will encounter, and there is an interface for Git in IntelliJ, our development environment.
To get started, visit this link: http://git-scm.com/download/win
and allow it to download the Git 1.8 installer.
Run the installer. All the default settings should be okay, although you can make changes in step 4 if you prefer that installers don’t pollute your desktop and quick launch bar with rarely-used icons.
SSH is the secure shell program for connecting to remote servers. Git uses it to upload your assignments. We need a bit of configuration for this to work.
From the Windows start menu, select All Programs » Git » Git Bash. It will open a command line (terminal) window.
At the bash prompt ($
), type the following command and press enter:
ssh-keygen
It should produce output like the following. You will have to press enter three more times: once to use the default file name, and twice to enter an empty passphrase. Your fingerprint and ID will differ from mine, of course.
Next, you need to create a configuration file for accessing my server. Enter this command at the bash prompt:
notepad .ssh/config
In the notepad window, type the following, on two separate lines:
host liucs.net
port 1010
Save the file (File menu » Save) and close notepad.
Finally, type the following command at the bash prompt:
notepad .ssh/id_rsa.pub
The notepad window will contain ssh-rsa
followed by a long code. This is your public key. Select all (control-A), then copy (control-C), and paste the content into an email message to . Also include your full name in the email message.
You may now close notepad and the git bash window.
Start at http://developer.android.com/sdk/
but skip the “ADT Bundle” link – that’s intended for Eclipse users. Instead, look for where it says “Use an existing IDE,” and download the SDK Tools for Windows.
Run the install after the download finishes, and work through the wizard.
Pay attention here, at step 4. You can leave this as the default, or move it to Program Files
if you prefer, but you will need to make a note of this path, so we can tell IntelliJ about it later.
Once the setup finishes, allow it to launch the SDK Manager. For now, we’ll just select a few things, and we can come back to this program later if we need anything else.
Choose the two entries under Tools. Under the latest Android API, you’ll need at least SDK Platform and one System Image. You may find the documentation and samples helpful.
Accept the license agreements, and then wait for those downloads to finish.
We will use the JetBrains IntelliJ IDEA as an integrated development environment for Java – both in this course and in the Android project course. Download the free community edition here: http://www.jetbrains.com/idea/download/
You can get the latest version (12), although some of the screens here refer to version 11.
The defaults in the wizard are fine, although again you can make changes in step 3 if you prefer that installers don’t pollute your desktop with icons.
Start the IntelliJ IDEA from the Windows start menu » All Programs » Jet Brains, or use the desktop icon.
It may ask if you want to import previous settings, just accept the default.
Eventually, you will see the initial screen, with some choices for getting started.
First, we need to do some configuration. Select the Configure » Project Defaults » Project Structure. With the top-most screen selected in the left navigation bar (Project Settings » Project), you should see a Project SDK section on the right. Click the New button and select JDK.
You’ll see a directory chooser, in which you must navigate to Program Files » Java » jdk1.7.0_11.
Once that is selected, click OK on the chooser. The Project SDK should now show version 1.7.
Next, we need to configure the Android SDK to use. In the navigation bar on the left of the Project Structure dialog, select Platform Settings » SDKs. Then use the plus sign in the top of the next column, and select Android SDK.
Once again, in the directory chooser, navigate to where your Android SDKs were installed. The default was \Users\YOURNAME\AppData\Local\Android\android-sdk
. You may need to select the button “Show Hidden Files and Directories” to see AppData
.
Hit Okay a few times to save all the dialogs.
The last bit of configuration is to tell IntelliJ about git. Back out of the Project Defaults screen and choose Settings. Within that dialog, look for Template Project Settings (the first section) » Version Control » Git.
The executable path is probably already set, but if it isn’t, use the ‘…’ button to navigate to Program Files » Git » bin » git.exe
. It’s fine to leave the SSH executable as built-in, but I suggest enabling the auto-update option. The ‘Test’ button should report that it found the right version of git. Click OK to save the settings.
Congratulations! Your machine is fully configured for Java development and assignment submission.