CSCI 235: Java on your own computer

If you wish, you can set up your own computer so that you can write and run Java programs there, too. There are three things that you need to have (if they are not there already):

Exactly what you need depends on what operating system your computer is running.

You can also get Mercurial for your computer; I'll work on adding instructions for that here, too.

Beyond the basics (the sort of environment we've used in the lab), you can get an Integrated Development Environment (or IDE), a program that bundles together all of the functionality you need—usually with some extra goodies thrown in. We have not used an IDE in this class so that you would have some understanding of the things that a good IDE does as if by magic. Learning to use any particular IDE (and there are a bunch of them) well takes a fair investment of effort on your part. See below for a some more information about IDEs for Java and other languages.

These instructions should be enough to enable you to create and run GUI programs, but you need to keep one important detail in mind: sizes of GUI components may be rather different on your computer from what they are in the lab. That happens because (a) the unit of measurement for graphics is the pixel, which varies from display to display, and (b) text may be in rather different fonts on different computers.

What follows are instructions for each of Mac OS, MS Windows, and Linux. But first, getting the JDK, which is common to all of them.

Getting the JDK

For all but Linux, getting the JDK simply requires going to website at java.com, finding your way through the links for developers to the JDK download page for Java SE, and selecting the version for your system. Note: the version of Java in the lab is "Java SE 7", for which you'll have to scroll down past the version 8 information.

Follow the instructions there to install it on your computer. Note that there is a further link to instructions for each operating system. Once you've done that, you should be able to run the Java compiler (javac) and Java programs (command java) from the command line.

Mac OS

The command line in Mac OS is accessed by running the Terminal program. The window you get is very much like the terminal windows you've used in the lab; you should be able to run the commands as javac and java.

You can get an Emacs that plays well with Mac OS by installing a version called Aquamacs, from http://aquamacs.org/.

Microsoft Windows

The command line in Microsoft Windows is called Command Prompt; it is usually found in the Accessories folder of the menu. What you have there is a bit different from the shell in Linux or Mac OS, but the command to change directories is still cd. The command to list a directory is dir (instead of the ls in Linux). On the command line, you probably need to use backslashes instead of (forward) slashes to separate components of a name, and you will need to put a name inside quotation marks if it contains a space.

At least skim all of the Windows-specific installation instructions at the Java download site; do not neglect the section about "Updating the PATH Environment Variable", even though it is marked as optional. Note that the directory name you will need is probably not the same as what appears in the instructions; to figure out what it needs to be:

  1. Open a Command Prompt window.
  2. At the prompt, type this, hitting the TAB key for TAB:
    dir c:\ProgTAB\Java\jdkTAB\bTAB
    That will leave you with a command line something like
    dir "c:\Program Files\Java\jdk1.7.0_45\bin"
    What is in the quotes is what you need to add to the PATH variable.
(Unfortunately, you may need to update the PATH later if you update your Java installation.)

Installing a version of Emacs on MS Windows is not as straightforward as it is on other platforms. There are several other editors that are easier to install and not too difficult to use; one of those is Notepad++, which you can find at http://www.notepad-plus-plus.org/.

Linux

details to appear...

IDEs for Java

details to appear...


Cary Gray

Last modified: Fri Aug 29 10:39:13 CDT 2014

Valid HTML 4.01!