CSCI 201 Lab 1 -- Windows version

The goal for this week's lab is to learn about the computer environment and applications you'll use in your CSCI 201 labs and classwork. You don't need to have a broad knowledge of computers to write simple programs, but there are a few skills you'll need and this is your chance to learn a practice a few of them. Here's what we'll cover.

  1. Controlling applications in a windowed environment
  2. Using files and directories
  3. Accessing class information on the Internet
  4. Sending and receiving email
  5. Using FTP to submit assignments
  6. Running Java in a command session

Controlling applications in a windowed environment

If your computer is turned off, power it on.

The running computer should display a desktop similar to the following picture:
Windows 95 desktop
The display will vary a bit depending on the operating system running on your machine. You'll see sample screens from both Windows 95 and Windows XP in the page, so don't be alarmed if your results vary a bit from our examples.

The taskbar and the Start button

At the bottom of the screen is the taskbar. It contains the Start button, which can be used to quickly start, or even restart, a program.

Select the Start button with the left mouse button and you will see a menu that allows you to run applications by selecting them with your mouse.

Move your mouse so that the cursor moves up and down the selection of programs on the Start button menu. Notice that when you move the cursor to a menu selection with a right arrow, a sub-menu is displayed showing you more even more selections.

We will now start a program using the Start button menu. The program that we will run is called WordPad. To start WordPad:

This will cause the WordPad program, or application, to start running. In generally, each running Windows program lives in its own window.

The title bar and its controls

Observe the window for the WordPad application.
At the top of the window is the title bar which shows the name of the application that is running. On the right side of the title bar are three control buttons: _OX. The rightmost button, Close button, is the close button. This button terminates the running application and closes its window. The middle button, Maximize button, is the maximize button. It expands the window to the size of the full screen. At this time the middle button in transformed into the restore down button, Restore Down button, which can be used to restore the window to its former size. Only the left-most or minimize button remains, Minimize button. This control suspends the application and places it on the taskbar where it can be restarted later. On the taskbar the application is represented by a restore up button, a Restore Up button, that can be used to redisplay the running program.

Moving and resizing the window

If you press the rightmost mouse button within the titlebar of a window, you can drag the application to different locations within the screen

If you move the mouse to the edges or corners of a windows, the cursor will become a two-headed arrow. If you then press and hold down the leftmost mouse button, you can change the size of a window.

Trying it out

There's no point in giving more explanation. It's time for you to take your WordPad for a spin around the display. Move, resize, minimize, restore up, maximize, and restore down. If you have any trouble, get the attention of your lab instructor or the person in the adjoining chair.

Running applications

Directly below the titlebar of gedit is the menu bar, a row of words such as such as File and Edit. If you press a word on the menu bar, you will rewarded with a pulldown menu, which can be used to direct the actions of the applications. Below the menu bar, you'll often find a tool bar, containing many icons that represent frequently performed actions, such as printing.

Using files and directories

If you've taken, CSCI 107, you should have learned quite a bit about directories and files in Lab 2 of CSCI 107. If this is your first exposure to this concept, settle in for a few minutes of serious study. A file is a collection of data, generally formatted for use by a specific application, such as a database or spreadsheet. A directory is a collection of files and other subdirectories.

File names

Files and directories have names. In both the Unix and Windows worlds, these names are series of directory names separated by slashes: forward slashes, /, in Unix; and backward slashes, \, in Windows. (By the way, it was Unix that first used the slash.) Here are some example file names in Unix and Windows:

Notice, that both of the above file names start with a slash, which means that both emanate from a special root directory. These are called absolute file names. Windows has the additional complexity that absolute file names may start with a drive letter, as in A:/autoexec.bat. This tells us that the file is located on a specific drive. Generally, drive letter A is the floppy disk drive and C is the hard disk. You may also notice that our example Windows file name contained spaces while the Unix file name did not. Although you can put a space in a Unix file name, you would only offend the true Unix gurus.

Notice that both of our example names end with ".html". In both Unix and Windows it is common for file names to end with a period followed by an extension, "html" is our examples. The extension generally identifies the type of the file. You'll be generating a lot of files with the extensions "java" and "class" this term.

Both Unix and Windows support relative file names. These names do not begin with a slash and are considered to emanate from the current directory. So, if your current directory is /usr/bin (or C:\Program Files) and you speak of the file X11/mwm (or X11\mwm), you are really talking about /usr/bin/X11/mwm (or C:\Program Files\X11\mwm).

Graphical display of files

Most computer users, especially those of the Macintosh sect, use directories and files with absolutely no idea of how a slash is used in a file names. They use file "explorers".

If you are using an ancient version is Windows, select Windows Explorer from the Programs menu of the Start menu.

If you are using a recent version, left-click on the Start button and then select Explore; or, if you wish to exercise your mouse skills, you can navigate through Start, All Programs, Accessories, and Windows Explorer.
You'll notice that the icons representing files and folders are quite large in above example. The View submenu has a List that can make these a reasonable size.

Windows Explorer can be used to display the hierarchical tree structure of files and folders (Folder icon) on your computer. The left-hand side of the window displays the directory tree structure and the right-hand side of the window displays the contents of the selected directory (File icon). To display the contents of a different directory left-click on that folder. Use the scroll bars on the sides of each window to view the entire contents of both windows.

Making folders and files

Locate the C:\Files folder in the directory tree structure and open it. Create a new subdirectory of C:\Files by right-clicking in the right-hand side window and then selecting New followed by Folder. The new folder is called New Folder. Since its uninspiring name is initially highlighted, typing Lab1 followed by a carriage return will rename the directory.

We will use this directory later in the lab.

Accessing class information on the Internet

If you don't know how to use a browser, such as Netscape or Internet Explorer, then:

So, start up your browser and load the following URL:

From there you should find a link to the course lab page. Follow it to Lab 1. From this point on, you are expected to complete this lab, and all future labs, by viewing the lab instructions in your browser.

Sending and receiving email

At UNCA, you must be able to read and send mail from your bulldog account. This is the email address that UNCA faculty will use for "official" classroom correspondence. There are two ways to read and send mail from your bulldog account:

We're going to assume that most of you will use WebMail since it allows you to read email using any Internet browser. We're also going to assume that most of you have already used WebMail. If you haven't, you need to read UNCA's Web Based E-Mail User's Guide.

Some of you may already have an off-campus email account you'd like to use for course-related mail. If so, you must set up your bulldog account to forward email to your off-campus account, because some UNCA faculty will not send confidential course-related email to an off-campus address. You can ask the folks in the Computer Center for help in setting up mail forwarding.

Lab email assignment

Your first task is to read your bulldog email to obtain the name of your 201 drop-off directory. It should be contained in an email message from the course instructor. Remember this information but do not share it with others.

Your second task is to send a short note to your lab instructor telling him/her about your computer experience. The email address of your CSCI 201 lab instructor is given in the table below:

Mark Boyd
J. Dean Brock
Susan Reiser
Charlie Wallin

Using FTP to submit assignments

FTP, or File Transfer Protocol, is a very simple program that can be used to transfer files between different computers. In CSCI 201, you will use FTP to transfer program solutions to your assignment drop-off directory stored on the UNCA CSCI file server.

Preparing to FTP

You need a file to ftp. You can get one by cutting the following Java code and pasting it into your WordPad application.

//       Author: Lewis and Loftus
//  Demonstrates the basic structure of a Java application.

public class Lincoln
   //  Prints a presidential quote.
   public static void main (String[] args)
      System.out.println ("A quote by Abraham Lincoln:");

      System.out.println ("Whatever you are, be a good one.");

Now save the file in your C:\Files\Lab1 directory under the name Be sure that you "click" through all both the Files and Lab1 directories in the process of saving this file! Also, it is extremely important that you save the file as type "Text Document".
File Save example

Before you can transfer the file you must know the name of the directory that you will use when submitting your homework. This is your personal ftp directory and it should never be used by others. Your ftp directory name is like a password, it should be kept secret.

The original FTP program

The ftp program "speaks" the FTP protocol to a file server when it transfer files. The ftp program was one of the first two Internet applications. It is a text-oriented program that may seem a little quaint compared to today's graphic-oriented programs, like the ones you'll be writing in Java. We are going to use the original ftp program because it is the only FTP uploader that "ships" with every copy of Windows XX and Unix. So you should be able to follow this procedure at home or school, no matter what computer is sitting in front of you.

Transferring files to your drop-off directory

Remember, you can going to transfer a file (and later files) to your drop-off directory. You'll need to know three pieces of information to complete this task.

  1. The name of the PC directory containing the file. In our example, that is C:\Files\Lab1.
  2. The name of the files to be transfered. We'll use
  3. The name of your drop-off directory. In our example, we'll use alincoln1809.

Starting the FTP program

If you press the Start button, you'll see menu button labeled "Run". Press this. Type "ftp" into the Open field and then hit enter.
Starting FTP from Run
This will cause a Windows (or MS/DOS) command window to open.

The FTP program should provide you with the following greeting:

Connected to
220-Welcome to, Sat Aug 10 15:25:15 2002
220 FTP server ready.
User ( 

You should type ftp followed by the Enter key at this initial user prompt. You will then be prompted for a password. Just type your email address as your password. Your email address is your bulldog user-id followed by For example, if your bulldog user-id is alincoln, your email address is Your email address will not be displayed when your typed it.

If you have successfully connected, the ftp program should be at its command prompt.

Connected to
220-Welcome to, Sat Aug 10 15:25:15 2002
220 FTP server ready.
User ( ftp
331 Guest login ok, send your complete e-mail address as password.
230-This is the anonymous FTP server of the Department of Computer Science
230-at the University of North Carolina at Asheville.
230 Guest login ok, access restrictions apply.

Your next step to do connect to the local directory where your files are now stored. This is done with the lcd, local change directory, command.

ftp> lcd c:\Files\Lab1
Local directory now c:\Files\Lab1.

Now you must change to your secret drop-off directory. This is done with the cd command. In our example the secret drop-off name is alincoln1809; consequently, the remote drop-off directory is pub/201/alincoln1809. In general, if your secret drop-off name is LOGINnnnn, your drop-off directory is pub/201/LOGINnnnn. And finally: Yes, the slashes go one way for local directories and the other way for remote directories.

ftp> cd pub/201/alincoln1809
250-Abe Lincoln's CSCI 201 dropoff
250 CWD command successful.

Transfer the file(s) that you want to submit by typing the put command followed by the file name. You should receive some indication of successful transmission. Remember, we are submitting

ftp> put
200 PORT command successful.
150 Opening ASCII mode data connection for
226 Transfer complete.
ftp: 650 bytes sent in 0.00Seconds 650000.00Kbytes/sec.

You can use the dir command to list your remote drop-off directory and the quit command to end your ftp session. Don't worry about the format of the dir command. Just make sure your submitted file is listed in the rightmost column.

ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 2
-rw-rw-r--   1 brock    csci201       31 Aug 10 14:21 .message
-rw-rw-rw-   1 bruce    csci201      632 Aug 10 14:42
226 Transfer complete.
ftp: 141 bytes received in 0.02Seconds 7.05Kbytes/sec.
ftp> quit

Switching between programs in Windows

By now, you must be wishing for an easy way to flip between programs in Windows 95. Press the ALT and TAB keys simultaneously to bounce between ftp and your browser.

Running Java in a command session

We're going to run Java the old fashioned way. First start a Windows command session. You will find this under the Accessories submenu of the programs menu. Recent versions of Windows generally label this "Command Prompt". You may see "MS-DOS Prompt" in older version.

We'll be using Sun's J2SDK, Java 2 Software Development Kit, in CSCI 201. You'll find a copy of the J2SDK on the CD-ROM distributed with your textbook. It can also be downloaded from Sun's Java Technology page.

We want everyone to be using version 1.4.0_01 of the Standard Edition (J2SE) of the Java Software Development Kit. Determine your version by typing the command "java -version". You should see something similar to the following output.

C:\>java -version
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

If your version is not 1.4.0_01, you need a new J2SDK install. If you have not installed any Java software development kit or if you have not set your path properly, you will probably get the message.

'java' is not recognized as an internal or external command,
operable program or batch file.

If you've installed the correct Java software development and get the preceding command, you need to add the directory C:\j2sdk1.4.1_01\bin to your path, the list of directories searched for commands. Doing this right varies according to your Windows version. We suggest you consult Sun's installation instructions for Windows to find out how to set the path "permanently".

The quick-and-dirty fix (which will get you through this lab in the UNCA computer labs) is to use the following command to place the Java directory on the front of the path.

set path=C:\j2sdk1.4.0_01\bin;%PATH% 

Now let's connect to the C:\Files\Lab1 directory and use javac, the Java compiler, to compile our program.

C:\>cd \Files\Lab1


The java compiler, javac, translates your program into bytecode. If you now type the dir command, you should see another file called Lincoln.class that was created by the compiler and contains your bytecode. If you don't, you need to ask your lab instructor for help.

 Volume in drive D is XXXXXXX
 Volume Serial Number is 5555-5555

 Directory of C:\Files\Lab1

08/10/2002  04:39 PM    <DIR>          .
08/10/2002  04:39 PM    <DIR>          ..
08/10/2002  04:39 PM               485 Lincoln.class
08/10/2002  03:25 PM               650
               2 File(s)          1,135 bytes
               2 Dir(s)   3,212,124,160 bytes free

The class file is used by the java interpreter. To run the file, type the command "java Lincoln". You should be rewarded with the output of the Java program.

Cleaning up

Remove the files in your C:\Files\Lab1 directory and go home.