javadoc tool.If you are not used to debugging Java programs, you should get used to it soon. Even small programs of the sort we deal with in CS 146 are often complicated enough that a debugger helps greatly to deal with run-time errors.
Of available Java implementations, Visual J++ does not support the Collections API, so it is not suitable for this course.
Using TextPad is not recommended for CS 146 because of its lack of a debugger. Similar cautions apply to the free version of JCreator, and to the use of Sun's JDK without a graphical IDE.
Possible implementations include BlueJ, JBuilder and Forte (now officially known as Sun ONE Studio 4). They are compared in the table below. While BlueJ is designed for education, the other two are stripped-down versions of large commerical products. Downloading the free (personal) version of JBuilder is rather intrusive (it requires your enabling cookies and JavaScript, completing a moderately intrusive survey, and providing your phone number to a representative that is promised to call). The free (community) version of Forte also requires creating a login name and password.
All three of these implementations support the important notion of a project. A project is a collection of classes that are considered together. In particular, they can be compiled together in a single operation. Different projects will usually need to look for Java class definitions in different places, and in some Java implementations you will want or need to tell the implementation how to do this. Each assignment in CS 146 should be treated as a separate project. Note that a project is not the same thing as a package.
| implementation | BlueJ | JBuilder, Personal version 7 | Forte for Java 4, Community edition |
|---|---|---|---|
| download address | www.bluej.org | www.borland.com/products/downloads/index.html | http://wwws.sun.com/software/sundev/jde/features/ce-features.html |
| approximate size of download (excluding JDK) | 1 MB | 25-60 MB | 40 MB; 125 MB of hard drive space is required, according to the download site |
| approximate size of downloaded, expanded files | 3 MB | 100 MB | 85 MB |
| to create a new project | Select New Project from the Project menu. Select a folder to contain the project, give the project a name, and click on the Create button |
There's a New Project choice under the File menu. It's also possible simply to open the corresponding *.jpr file in Windows Explorer |
Select Project Manager from the Project menu, and click on the New button |
| to open an existing project | Select Open Project from the Project menu. Select the folder that contains to the project. |
Select Open Project from the Project menu. Find and open the appropriate *.jpr file |
Select Project Manager from the Project menu, select the desired project, and click on the Open button. You should also mount at least one filesystem (see "to set project properties") |
| to set project properties | Select Properties under the Project menu. You should at least specify the source directories (where JBuilder will look for class definitions) and an output directory (where *.class files will go). You may also want use the Default Properties menu choice to establish default values for these properties |
To mount a filesystem (tell Java where to look for classes), select the ilesystems tab in the project window, right click on the Filesystems icon, click on Mount and Local Directory and then select the desired folder |
|
| to add an existing class | Select Add Class from File from the Edit menu |
Select Add To Project from the Project menu, select the desired file, and click on Open. |
Select the Project tab from the project window, right click on the project icon, and then select Add New |
| to create a new class | Click on the New Class button, or choose New Class from the Edit menu |
Select Add To Project from the Project menu and enter the name of the desired file after navigating to the desired folder. |
Select the Project tab from the project window, right click on the project icon, and then select Add Existing |
| to remove a class from the project | The Remove choices from the Edit menu and the menu obtained by right clicking on a class will both delete the source file permanently! |
Select the Project tab from the project window and select the class to be removed, and then choose Remove from Project from the Project menu |
Select the Project tab from the project window, right click on the class icon, and then select Delete |
| to edit a file or class | Double click on its icon in the main project window | Select the Project tab from the project window and double click on the class name |
|
| to compile a file or class | Right click on the class icon and (left) click on Compile, or click on Compile in the edit window. |
Select the Project tab from the project window and select the class to be removed, and then choose Make [filename] from the Project menu. |
Select the Project tab from the project window, right click on the class, and then select Compile. You may also use the Build menu |
| to build a project (compile all its files) | Click on the Compile button in the project window |
Select the Project tab from the project window and select the class to be removed, and then choose Make Project from the Project menu. |
To compile an entire project, select Compile Project from the Project menu or (to rebuild) select Build Project. You may also use the Build menu |
| to run (execute) a class or project | Right click on the class icon and (left) click on main (or other desired method) |
Select Run from the Run menu to execute a project |
Select Execute from the Build menu |
| to debug a class or project | Selecting Show Debugger in the project window's View menu will show the debugger, as will clicking on the striped icon during execution. Setting a breakpoint in the editor will also show the debugger window when the breakpoint is reached |
Select Debug from the Run menu |
Use the Debug menu
|
| to redirect output* | Text in a BlueJ terminal window may be saved to a file by selecting Save to file from the window's Options menu |
Text in a JBuilder output window may be selected (i.e., copied to the Windows clipboard) by clicking on the icon in the window's title bar, and selecting Edit and then Select All. It then may be pasted to any file |
Right click in the output window, and make the desired selection |
creating javadoc files
| The Project Documentationchoice from the Tools menu of a project window will generate and display javadoc documentation. When editing a class, its documentation may be viewed by selecting Interface (rather than implementation from the editor's toolbar |
?? | Select the Filesystems tab from the project window and right click on the desired class. From the Tools menu, select Generate javadoc. To view the documentation, select Show javadoc from this menu |
| other features | BlueJ is missing several useful features that other implementations have -- e.g., the "command completion" feature that will list all possible methods applicable to an object when you type in the object's name followed by a dot?? | JBuilder: to retain ouput window after execution -- in Project menu, select Properties, and then Run/Debug tab, and uncheck Close Console Window on exit. This tab also allows output to be redirected to an execution log. | Be aware of the workspace tabs: Editing, GUI Editing, Running, and Debugging |
| to find a tutorial | check under the Help menu. |
?? | Select Learning from the Help menu |
* Output can be redirected to any desired file by running the JDK Java interpreter directly on the class file containing the main method, and redirecting the output to the desired file.
Forte project information is in forte-settings\system\Projects