How to Create a Project in JBuilder
Home Up Search Java 2 API C++ Resources

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:

  1. Bring up JBuilder on your computer.
  2. 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.
  3. On JB's main menu, select File/New Project.
  4. You will be lead through a "wizard" to create your new project.
    1. 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!
      1. 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".
      2. 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".
      3.  Check that desired name of your project has  no spaces in the name .
      4. Click "Save" to return to the wizard page.
      5. Click on "Next".
    2. Fill in the title of your project and your name in where indicated.
    3. Click on "Finish".
    4. JBuilder will create an empty project for you.
  5. 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:

  1. Select "Project/Properties" from the main menu.
  2. Select the "Paths" tab.
  3. 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:

  1. 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".
  2. 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.  
    1. To view the execution log, select View/Execution Log from the main menu.
    2. The execution log can be cleared by right clicking it, and selecting "Select All"   and then hitting the Delete key.
  3. Code Style tab:   Select "Next Line" for "Braces" and "Anonymous adapter" for "Event handlers".