This document describes the procedure to set up your Apple Mac OS X computer for Java development and for submitting the course assignments using git.
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/mac
and allow it to download the Git 1.8 installer.
Open the downloaded disk image, and you’ll see a package installer. Double-click it to open.
Proceed through the installation; there really aren’t any decisions to make, but you’ll have to type your account password.
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.
In the finder, go to the Applications » Utilities folder, and open the Terminal application.
At the terminal 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 these two commands at the bash prompt:
touch .ssh/config
open -e .ssh/config
In the text editor that pops up, type the following, on two separate lines:
host liucs.net
port 1010
Save the file (File menu » Save or ⌘-S) and close the editor.
Finally, type the following command at the bash prompt:
open -e .ssh/id_rsa.pub
The editor window will contain ssh-rsa
followed by a long code. This is your public key. Select all (⌘-A), then copy (⌘-C), and paste the content into an email message to . Also include your full name in the email message.
You may now close the editor and the terminal window.
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 the screens here refer to version 11.
Open the downloaded disk image, and you’ll see a window like the following. Drag the IntelliJ icon into the Applications folder.
Start the IntelliJ IDEA from the Applications folder. You’ll have to agree to open the app, since it was recently downloaded.
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. In the Project SDK section, click the New button and select JDK.
You’ll see a file chooser, in which you must navigate to System » Library » Java » JavaVirtualMachines » version.jdk. Note: If you cannot find any version.jdk file on your system, let me know right away, and tell me what version of Mac OS you are running.
Once that is selected, click OK on the chooser. The Project SDK should now show a version number, and you can click OK again to apply the settings.
The other bit of configuration is to tell IntelliJ about git. Choose ‘Preferences’ from the IntelliJ IDEA application menu.
Within that dialog, look for Template Project Settings (the first section) » Version Control » Git.
The executable path should be set to /usr/local/git/bin/git
(with no spaces, and all lower-case letters). It’s fine to leave the SSH executable as built-in, but also enable the auto-update option. The ‘Test’ button should report that it found the right version of git.
Click OK to dismiss the git test, and also to apply the new settings.
Congratulations! Your machine is fully configured for Java development and assignment submission.