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 thetio package.
There are three files Console.java, ReadInput.java
and PrintFileWriter.java, and three class files Console.class, ReadInput.class
and PrintFileWriter.class.
Put these six files in a folder names tio. E.g. c:\mystuff\tio
Start JBuilder.
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).
Go to Tools/Default Project Properties
Click Libraries
Click New
fill in the name as tio
Click the ... next to the Class Path window
Click Add Path
locate c:\mystuff using the dialog
click OK
click OK
click OK
You should be back to the Default Project Properties
window
click Add
select tio
click OK
If this didn't work, here is more information on setting up
tio.
Install JDK.
Copy tio onto your machine into a
folder called tio.
Edit c:\autoexec.bat to include the
line:
set CLASSPATH=c:\path-to-jdk\lib\classes.zip;.;c:\path-to-folder-with-tio
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
Under
File select New then click on the icon labeled Class. Click OK.
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.
Click
Finish
A new
window appears titled New Java File
Delete
what it suggests for the package, leaving that box empty
Change
the suggested class name to something appropriate
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.
Click
OK
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.