A Java Course Outline
Using the Java By Dissection book
by Ira Pohl and Charlie McDowell


Editing, Compiling and Running Java Programs under Windows

This section contains general information about things you will need to know how to do in order compile and run your Java programs on a Windows system.

Here are some very brief instructions for using JBuilder. It has many features that we do not yet need. These features may even be confusing at this point. If you have a PC running Windows95/98/NT you can get a free copy of JBuilder for use on student work.

Just Once

Just once you need to do the following. This tells JBuilder where to look for the tio package.

Get a copy of the tio files.

  1. There are three files Console.java, ReadInput.java and PrintFileWriter.java, and three class files Console.class, ReadInput.class and PrintFileWriter.class.
  2. Put these six files in a folder names tio. E.g. c:\mystuff\tio
  3. Start JBuilder.
  4. Make sure that JBuilder is installed in a directory such that the path to the JBuilder folder does NOT contain any spaces (e.g. "Program Files" is NOT an OK place for JBuilder).
  5. Go to Tools/Default Project Properties
  6. Click Libraries
  7. Click New
  8. fill in the name as tio
  9. Click the ... next to the Class Path window
  10. Click Add Path
  11. locate c:\mystuff using the dialog
  12. click OK
  13. click OK
  14. click OK
  15. You should be back to the Default Project Properties window
  16. click Add
  17. select tio
  18. click OK

If this didn't work, here is more information on setting up tio.

  1. Install JDK.
  2. Copy tio onto your machine into a folder called tio.
  3. Edit c:\autoexec.bat to include the line:
    set CLASSPATH=c:\path-to-jdk\lib\classes.zip;.;c:\path-to-folder-with-tio
  4. If the file doesn't exist, create it, if it exists, just add the line at the end. The path-to-jdk is where you installed jdk.

Look for classes.zip, it should be in a subfolder lib (or LIB). The path-to-folder-with-tio should not end in tio but should in at the folder containing the folder tio. For example, if tio is right at the top of the c drive then just use c: nothing else.

To start a new program

  1. Under File select New then click on the icon labeled Class. Click OK.
  2. It will offer to use file like C:\JBuilder\myprojects\untitled1\untitled1.jpr you can browse to find some folder you want to put it in or just edit the line to something like: C:\homework\hw4\hw4.jpr You can even use what it suggests.
  3. Click Finish
  4. A new window appears titled New Java File
  5. Delete what it suggests for the package, leaving that box empty
  6. Change the suggested class name to something appropriate
  7. For now uncheck the two checked boxes under style and check generate main function.
    IMPORTANT - if you forget to check the generate main function button it won't be setup properly.
  8. Click OK
  9. You should now have a window with the beginnings of a class file in it. You can edit the file. Feel free to delete the stuff it added that looks unfamiliar.
  10. You can now run it, look under the Run menu.

Feel free to report any site problems to the Webmaster, Debra Dolsberry.