Getting Started with Visual J++
Creating a New Project
-
Create a folder on your disk where your COMP 14 programs will reside. Calling
it something like Comp14 is a good idea. If you are using a public
machine, you will save your programs onto a diskette.
- Launch Microsoft Visual J++ 6.0 by pressing the Start button, then
selecting Programs, then UNC Courseware, then Comp 14,
and finally, Microsoft Visual J++ 6.0
-
The first screen has three tabs: New, Existing, and
Recent. Click on New.
-
On the left side of the window, click on Visual J++ Projects.
On the right side of the window, click on Empty Project.
-
Replace the Name field with the name of the project (usually something
like Assignment1, Assignment2, etc.)
-
Click on Browse and click on the folder or diskette in which you
want to store the program.
-
Click on the Open button.
-
You should now see the Project Explorer window. If you don't see it, go
to the View menu (on the top) and select Project Explorer.
For example, if the project name was Program1, the Project Explorer
window should look like the figure below.

Adding a New Class
-
Right click on the project name in the Project Explorer window. Select
Add, then Add Class from the submenu.
-
In the Add Item window, click on Class on the left and click
on ClassMain on the right. Give your new class its proper
name (specified in the assignment). Click on Open.
Building the Project
-
Save the program by selecting Save All from the File menu.
Save your program periodically. If the machine crashes, you may lose everything
you did since your last save, so saving every five or ten minutes is a
good habit.
-
Select Build from the Build menu. You should see a "Solution
update succeeded" message at the bottom of the screen, and the Task List
window should show no errors. If the Task List window is not visible, you
can make it appear with the View menu, then the Other Windows
submenu. If there are errors, double clicking on the error message will
show you the (approximate) location of the error. Fix the error and build
again.
-
Continue the build and fix cycle until all errors are corrected and the
update succeeds.
Running the Program
If you don't know what the command prompt is --
- Select Start from the Debug menu. A dialog box titled
[name of project] Properties will appear. ([name of project]
should be replaced with the name of your current project.) Check the
"Launch as a console application" box. Then click OK. This
should start your program running.
- A window will appear, executing your program. When the program has
completed execution, press Enter to close the window.
If you do know what the command prompt is --
- Bring up a command prompt window. If you're in the lab, DON'T use
the "COMP 14 command prompt" under "UNC Courseware."
- Change to the directory where your project exists.
- Type "dir" to get a listing of the files in that directory to make sure
you type the filename exactly.
- Type "jview [name of class with main].class" and press Enter.
(Replace [name of class with main] with the name of the class that contains the
main() method.
- The program will execute in the current window. When the program has
completed execution, press Enter to close the window.
Saving the Program to Turn-in
You only need to turn in files in your project directory that end in
".java" and ".class".
If you're building your project on a hard drive --
- Bring up either "My Computer" or "Windows Explorer" and change to
the directory where your current project exists.
- Select all of the ".java" and ".class" files (press the Ctrl key as you
click the mouse to select multiple files).
- Select Copy from the Edit menu to copy the files.
- Change directories to the A:/ drive.
- Select Paste from the Edit menu to paste the files to your
disk.
If you're building your project on a floppy disk --
- Follow steps 1-3 above.
the directory where your current project exists.
- Change directories to a folder on the hard drive that you can write files
to.
- Select Paste from the Edit menu to paste the files to the
hard disk.
- Put the disk you want to turn in into the floppy drive.
- Follow steps 2-5 to copy the files from the hard drive to the floppy drive.
Making a Backup Copy to a Floppy Disk
If you're building your project on a hard drive --
- Bring up either "My Computer" or "Windows Explorer" and change to
the directory where your current project exists.
- Go back one directory, by pressing the button that has an arrow inside
a folder on the toolbar.
- Select the folder that contains your project.
- Select Copy from the Edit menu.
- Change directories to the A:/ drive.
- Select Paste from the Edit menu to paste the folder
and all of its files to the floppy disk.
If you're building the project on a floppy disk --
- Follow steps 1-4 above.
- Change directories to a folder on the hard drive that you can write files
to.
- Select Paste from the Edit menu to paste the folder to the
hard disk.
- Put your backup disk into the floppy drive.
- Follow steps 3-6 to copy the folder from the hard drive to the
floppy drive.
Michele Clark
clark@cs.unc.edu