|
To activate all the powerful
software development features of JBuilder, one must create a
"project" that will manage the various files in the Java
program under development.
IF YOU ARE WORKING ON A
CLASS LABORATORY, BE SURE TO FOLLOW THAT LAB'S DIRECTIONS ON WHAT
DIRECTORIES TO CREATE & USE!! The following are
generic directions and may not be suitable for a specific
laboratory.
To create a project in JB, follow
these steps:
- Bring up JBuilder on your computer.
- Be sure that all other files and projects
are closed by using the menu choices under the main "File" menu.
You should see only a narrow toolbar across the top of your screen at
this point.
- On JB's main menu, select File/New
Project.
- You will be lead through a "wizard" to create
your new project.
- On the first screen you will be asked for a project
filename. In a box at the top of the screen, you
will see something like
"C:\XXXXX\untitled1\untitled1.jpr". FOLLOW THE NEXT INSTRUCTIONS VERY
CAREFULLY!
- If you have already created the necessary
directory tree: click on the browse button and using the file dialog
box that comes up browse to the desired subdirectory.
Select it and then add the name of the project file such that
it is the same as the directory name. The filename should end
in ".jpr".
- If the desired directory structure has not been made already,
type the full pathname into the field that asks for the
filename. For instance, type
"c:\scratch\cs150l1\cs150l1s1\cs150l1s1.jpr".
-
Check that desired name
of your project has no spaces in the name
.
- Click "Save" to return to the wizard page.
- Click on "Next".
-
Fill in the title of
your project and your name in where indicated.
- Click on "Finish".
- JBuilder will create an empty project for you.
- You will now need to create an "application"
which is an actual Java program that can be run. Note
that this set is not necessary if your are going to be adding
existing Java files that already have a "main()" method defined.
Setting the Project Properties
It is vitally important that the project properties be set before any files are added to the project!
In particular, the default package directory (the "source root
directory") and the "output root directory" must be properly
set. Failure to do so will result in extraneous files and
directories being generated, plus erratic compiling and
execution.
To set the project properties:
- Select "Project/Properties" from the main menu.
- Select the "Paths" tab.
- Be sure that the source and output root directories are set to be the same and equal to the
directory directly above the directory your
project is located. That would be "C:\scratch\cs150l1" in the
example above. If is not, click "Set..." to change the
output path. To change the source path,
first "Remove" any existing path(s) and then click the "Add.." button to
browse for the proper path.
Other settings of interest:
- Compiler tab: check off "synchronize
output" directory to have JBuilder automatically delete class files
that are not linked to a source file. If you do not do this,
if you do something like delete an anonymous button listener, then you
will get a compiler warning like "Cannot find source for such-and-such
class file".
- Run/Debug tab: Selecting "Execution log" instead of "Console"
will cause all output sent to the console (such as
System.out.println() and exception messages) to go to an execution log
file. This enables one to capture long error messages to be
viewed after the program is stopped executing.
- To view the execution log, select
View/Execution Log from the main menu.
- The execution log can be cleared by right clicking it, and
selecting "Select All" and then hitting the Delete
key.
- Code Style tab: Select "Next Line" for "Braces" and
"Anonymous adapter" for "Event handlers".
|