Assignment 00


Get ready for the course by writing a "Hello, World!" program on the same computer you plan to use to do your assignments and submiting it to Tamarin.

Text: Java Tutorial -> Getting Started -> Hello World
Concepts: compiling (review), using a command line (review)


Tamarin Account

Your Tamarin account will use your UH username and a password that you choose.

Unrelated to your Tamarin account, we also need an unique ID for each student in case we need to anonymously publish any grades.

Therefore, send an email to your TA ( OR with these two bits of information:

Allow at least 24 hours for your TA to setup your account after you email him.


If you are planning to use your home machine, you will need to download and install the JDK.

You may still have a version installed from ICS111. You can type javac -version on the command line to check if you do and see what version you have.

JDK 7, update 10, is the latest version, but any version from Java 5 and above will work for this course. Make sure you get the JDK (Java Development Kit), not the JRE (Java Runtime Environment). You do not need any additional bundles, such as NetBeans (a large IDE program used when writing code), JavaFX, or Jave EE, but these versions will also work if you install them instead.

Hello World

Using Notepad, Wordpad, JGrasp, or your favorite IDE, write a simple program that prints a line or two of text to the screen. Printing "Hello, World!" is traditional. Document what your program does and include your name in a Javadoc @author tag. For example:

 * My first program.  It prints a greeting to the screen.
 * @author Zach Tomaszewski
public class Hello {

  public static void main(String[] args) {
    System.out.println("Hello, World!");


Compile this program at the command line: javac

And then run it: java Hello

Of course, to submit this program, you will need to change its name to, where Username is your UH username. Remember that the class name must always match the file name and that Java is case-sensitive.

While you may use an IDE to write your code, make sure you can also compile on the command line as well. Later in the semester we will use other JDK tools besides just java and javac, so make sure your system is correctly configured now. See the tutorial reading linked above or the FAQs below if you run into problems.

What to Submit

First, email your TA your password and grading ID. Then, once you have a Tamarin account, upload your file to the Tamarin for your section.

Grading [10 points]

3 - Upload
You successfully upload a file to Tamarin.
3 - Compiles
The program compiles successfully.
4 - Output
The program prints something--a line or two of text--to the screen.


When I try to compile, I get the following error: 'javac' is not recognized as an internal or external command, operable program or batch file.
This means that Windows cannot find the javac program. The JDK install does not usually set your system PATH variable for you. Here's how to fix the problem.
  1. Find out where the javac.exe file was installed. It will probably be somewhere like C:\Program Files\Java\jdk1.7.0_10\bin\ (On Vista or Windows 7, also check in Program Files (x86), if you have one. You might also try a file search for javac.exe if you can't find it by browsing.)
  2. Once you find javac.exe, type the full path on the command line, something like this:
      "C:\Program Files\Java\jdk1.7.0_10\bin\javac" -version
    You may need the quotes around the file path if it contains any spaces.
  3. Doing this is just a test. If it works (Windows can now find javac and prints a line or so telling you the version), then Java is installed correctly and you know where it is.
  4. Now you can update your path so you don't have to type the whole path name every time. These are the steps to do this on Windows 7:
    1. Go to Start -> Control Panel -> System. (It's easiest to find System when you change Control Panel to Classic View.)
    2. Click the Advanced System Settings link. (Skip this step on WindowsXP.)
    3. Go to the Advanced tab
    4. Click the Environment Variables button
    5. Scroll down through the System variables until you find Path.
    6. Edit this variable, adding the path up to but not including javac (so probably C:\Program Files\Java\jdk1.7.0_10\bin\) to the end of the list. Make sure there is a ; (semi-colon) between this path and the one before it.
    7. Click OK for all of that, saving it all.
    8. Close any open command prompt windows (since these still have your old path settings).
    9. Open a fresh, new command prompt window. Typing either javac -version or javac should work now, without having to type the whole path to javac.
If you ran into problems, try searching YouTube for "java set path on windows" for walkthu videos. If you're still stuck, let your TA know how far into this process you made it and what went wrong. If you have a laptop, feel free to bring it into lab or office hours for help.
javac works, but when I compile I get this error:
  error: cannot read:
  1 error
Alternately, you might get this error:
  javac: file not found:
  Usage: javac <options> <source files>
  use -help for a list of possible options

Either of these means javac can't find the .java file you are trying to compile (in this case, Check that you are in the same directory as the file. Type dir on the command line and you should see your .java file in the list of files displayed.

If you need to switch directories to find where you saved, remember that cd .. moves up a level, and cd dirName will move down one level into the sub-directory named dirName. See Using the Windows Command Prompt for more.

I have a Mac, and there's no JDK download option for a Mac.
Modern Macs come with a JDK already installed.

To write your code, use the simplest text editor you can find listed under Applications. If there is no plain text option when you go to save the file, you may have to go to Format -> Make Plain Text (or something similar). This will remove all formatting toolbar options and allow you to save as plain text.

To compile and run your code, go to Applications -> Utilities -> Terminal. Terminal works basically the same way as the Windows Command Prompt, although instead of dir, you have to type ls (or ls -l, for a longer view). (Those are Ls, not 1s, since "ls" is short for "listing".) The cd, java, and javac commands are the same.