[Dr. Schoenly] [sbs@olemiss.edu] [contact info] [Univ of Mississippi] [Computer & Info Sci Dept]
Last update: Sunday, August 21, 2005, 06:12 PM

Dr. Schoenly's courses:
Frequently asked questions concerning implementation
and use of JDK (J2SDK) software on a typical PC



JDK5 = the most recent verions (1.5) of the Java 2 System Development Kit
earlier versions were commonly referred to as J2SDK

These comments are intended to be helpful to beginning students who are attempting to use the freeware Java Development Kit (JDK5, J2SDK) software for programming exercises in the introductory UM computer programming classes. Suggestions are welcome about how to clarify anything stated here, and about new entries that would be helpful for students.

See also my web page concerning the commercial programming editor, UltraEdit. (or go directly to UltraEdit's own page)


How should I install the JDK (the free Java software environment)?

Get a copy of the big JDK/J2SDK installation file: The name of the installation file will be a mouthful like:
    jdk-1_5_0_04-windows-i586-p.exe

Double-click the appropriate exe file to begin the installation. I recommend that you install the JDK5 software in a simple directory like "c:\jdk5" rather than the default, which may be deeply nested in your "Program Files" directory. After installation, you could use Windows Explorer to confirm that the files named "java.exe" and "javac.exe" really exist in the JDK5 folder on your C: drive, in a subfolder named "bin". The JDK5 directory/folder may be located deeply nested in your Program Files directory unless you carefully specify a "shallower" directory for installation.



How should I install the documentation files for the JDK5?

Get a copy of the big compressed documentation file associated with the JDK5 software. (See above for where to find the file; the file name will something like "jdk-1_5_0-doc.zip". Unzip the file to the JDK5 directory on your machine. You will wind up with a big subfolder named "docs".

Point your browser at the file named index.html in the subfolder named "api" -- you now have a comprehensive, free java guide at your fingertips as you work on your java programming exercises. Add a bookmark or toolbar link to your browser so you can easily return to that main index page whenever you need to do so.



Which editor will give me the best programming experience?

You can use Notepad to type in your java programs. However, for better programming experience, use a programmer's editor like UltraEdit:

For power and ease of use, I recommend
UltraEdit, but it costs some money to get a legal copy beyond the allowable free download period.

Go to my Ultraedit information page for further information about how to use this editor in connection with Java program development. Support the author of this fine program by buying a copy if you find it useful.

In any case, you need to use an editor that can handle plain text files, like Notepad. Your java source programs must be saved as plain text, with the file extension ".java" If you are using Notepad, you may need to enclose the file name in double quote marks, when doing a "Save As" operation, to ensure that your file has only the ".java" extension.


How can I set up the CSCI 111/112 textbook's "BreezySwing" classes for use on my machine?


The current CSCI 111/112 textbook (by Lambert and Osborne) uses some classes that are specific to that book and its sample programs. Go to the textbook's web site
http://www.wlu.edu/~lambertk/hsjava/ for detailed instructions about how to set up your machine to use these classes. Summary: (1) find the three relevant "JAR" files associated with these textbook classes; (2) copy those three files to two locations on your machine (one in your JDK5 folder, another in your Program Files Java directory).

This will be discussed and demonstrated in class. Email if you run into trouble doing this on your own machine.

Summary:
  1. Download or otherwise obtain copies of the three relevant textbook "jar" files: BreezySwing.jar, TerminalIO.jar, and TurtleGraphics.jar
  2. Copy the three files to your JDK5 installation directory. If you have installed the JDK5 to a directory named jdk5 on your C: drive, the correct location would be:
    c:\jdk5\jre\lib\ext
  3. Also copy the three files to your Program Files' java-related directory. For example, the directory on a typical PC might be:
    c:\Program Files\Java\jre1.5.0_01\lib\ext
  4. If you have other Java-related stuff on your machine, you may need to copy the three jar files to other directories. Look for folders named "ext".
Confirm that the three jar files have been really copied to these locations. You want exact copies of the files, not shortcuts to them.


Where should I store my java programs?

Create a folder on your C: drive in which you will store your java programs, or store your programs on a separate floppy disk, or USB memory stick, or CD-RW disk. Just remember where you have put your stuff. It is probably best NOT to store your own programming files inside the JDK5 directory. I.e. keep the JDK5 directory clean and unchanged from its original installation state.

I also recommend that you do NOT store your Java programming exercises in your Windows "Documents and Settings" directory, or your Windows "My Documents" directory, or directly on the Windows "Desktop" -- that makes it harder for you to find your files, and seems to cause problems sometimes with the javac and java commands.

Remember to keep backup copies of everything that you work on! Keep two backup copies, on different storage media. It is always sad to hear students complain about how they have lost all of their Java work due to hard disk failure, lost floppy, scratched CD, stolen laptop, etc.



Is it a good idea to keep backup copies of all of my Java programs, homework exercises, etc.?

Yes.

Multiple choice question: When should you make backup copies of your Java homework, etc.?
  1. before your PC or laptop experiences a crash or virus or other failure
  2. after your PC or laptop experiences a crash or virus or other failure



How can I simplify my typing of command-line javac and java commands? (Or, Why would I ever want to know anything about Windows Environment Variables?)


Do you want to simplify your typing of the "javac" and "java" commands (when entering these commands in a console window)?

On a typical Windows XP machine, go to Control Panel...System...Advanced...Environment Variables

Probably there will already be a "PATH" environment variable. Edit it to add an entry pointing to the bin directory of the JDK5 folder. For example, if your PATH variable looks like this:
C:\WINDOWS;C:\WINDOWS\COMMAND
you can change it to this:
C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JDK5\BIN
I.e. add a new entry, for the JDK5\bin directory, to your existing PATH statement. Use the exact name of the JDK5 directory/folder, as it has been installed on your machine. Note that it is a list of paths, separated by semicolons.

If you do not already have a PATH variable, then create one that points to the JDK5 folder, e.g. c:\JDK5\bin



How can I get a command prompt window?


On a typical Windows XP machine, go to Start...All Programs...Accessories. To save yourself some time, right-click the Command Prompt entry there, and do "Send To"...Desktop to create a desktop shortcut that you can use easily.



How can I change the characteristics of my command prompt window?


(a) Right-click your command prompt desktop shortcut. Change the "Start in:" textfield to: C:\

(b) Open a command prompt window. Right-click the title bar at the top. Select "Properties". Select the Font tab, the Colors tab, etc. to make all command prompt windows opened from that shortcut have whatever appearance you would prefer.



How to make "screen dump" printouts of your Java program in action


The programming assignment guidelines for your class probably specify that you are expected to turn in a printout showing your program in action. Here is one way to accomplish this, assuming that you have a printer connected to your PC:



What does the "NoClassDefFoundError" error message mean?


This error message is very common when attempting to enter the "java" execution command. If you are trying to execute a java program named HelloWorld, for example, it can mean:



Do I need to know anything about CLASSPATH statements?


The CLASSPATH environment variable is mostly relevant to advanced Java programmers. However, it can be relevant if quirky problems occur in your attempts to compile and execute your Java programs.

Is your machine having trouble finding a compiled program, in spite of the fact that you can see that you have saved a copy of it right next to your program? If so, then (on a typical Windows XP machine) go to Environment Variables (see above) and create or edit an environment variable named CLASSPATH with the appropriate entries.

For example, if your CLASSPATH looks like the following:
C:\PROGRA~1\CAFE\;C:\JDK5\LIB
you can change it to the following:
.;C:\PROGRA~1\CAFE\;C:\JDK5\LIB
I.e. add ".;" as the first entry in this semicolon-separated list of paths. This instructs the JDK compiler to look in the local folder first for imported packages.



email: sbs@olemiss.edu Dr. Schoenly's courses: http://cs.olemiss.edu/~sbs/
Downloads Computer Science Dept

Can't find what you are looking for? Email sbs304@yahoo.com or sbs@olemiss.edu for help.