Creating a Project with JBuilder


JBuilder uses what is called an integrated desktop environment (IDE) to conveniently perform both editing and compiling (and other tasks). More precisely, the JBuilder IDE provides a text editor window in which you can enter the text of a program, and then save that program in a file. Once your program is saved, you can translate it into byte-code using theJBuilder compiler and linker.

Starting JBuilder

To get started, invoke JBuilder according to your instructor's directions. (This may involve double-clicking on an icon on your computer's desktop, or clicking on the menu in the lower left hand corner and choosing JBuilder from a submenu.)

Our first program will input an integer and display twice that value, four times that value and then 8 times that value. We will thus name the executable program Mult, and name the source program Mult.java (Java source programs end in .java by convention.)

 

Creating a Project

The JBuilder IDE provides a convenient feature called a project that simplifies the translation of a source program into machine language. The normal procedure is to create such a project first, before we create any source files for our program, (though it is quite easy to add existing source files to a project.)

To create a project, move the mouse to the File menu and choose New Project from the menu. This should cause a dialog window named Wizard to appear. The first thing that we want to do is to create a new project. You should see a text area with something like:

C:\WINNT\Profiles\johndoe\jbproject\untitled\untitled.jpr

This is where JBuilder is proposing to put a new project named untitled. A project directory will be created and can be located by the path C:\WINNT\Profiles\johndoe\jbproject\untitled. Inside this directory will be all the files that the project needs including untitled.jpr which holds the basic information for the project (jpr is the standard extension for a JBuilder project file). Lets make the projects name something more appropriate for this exercise by changing both occurences of untitled to Mult. (Your instructor may give you additional changes that you need to make to the path.) Write down the path as you will need to use windows to navigate to this directory.

Once the project name and location is set, click on the next button. You are now given an opportunity to provide information about the project. Fill this in according to your instructors instructions and then click on the finish button. JBuilder will now go out and make a new project for you.

Creating the src directory

All of the source files for your project will be located in a directory called src which is inside the project directory that you just created. To make this directory, click on the back ground to get back to the windows operating system. Use the path you wrote down to guide you in opening folders starting with the My Computer icon. Once you are in your newly created project directory, click on the right mouse button (right-click) and choose New and then Folder from the menu that pops up. Change the name of the folder from untitled to src. 

Creating a Source File and Adding the ann Package

At this point we can copy any given source files into the src directory. We need the ann package. You can copy the version in the folder IncludedCode.

Lets create a new file named Mult.java in which to store our program. To do so, move the mouse to the File menu within the and choose File -> New Text File. A blank window will appear, named untitled. To give it the proper name, choose File -> Save and in the dialog box that appears, replace untitled with Mult.java. Make sure that it is being saved in the src folder under Mult. If not, navigate directory hierarchy. When you are in the right place, click on the Save button. The window will then be renamed Mult.java. Then choose Project -> Add to Project -> Add file. In the resulting window find and then click on Mult.java to add it to your project.


 

Back to the Lab


Back to the Table of Contents

Back to the Introduction


Copyright 2000 by Prentice Hall. All rights reserved.