Java Language Implementations for CS 146

To be appropriate for CS 146, a Java language implementation should minimally support the Collections API of Java 2, and provide an easy-to-use debugger. Ideally it will provide an easy-to-use graphical IDE, and integrate this IDE with the debugger and with the 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.

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. Microsoft's "Visual" products do not support the Collections API, and so are not suitable for this course.

Possible implementations include BlueJ, JBuilder and Forte (now officially known as Sun ONE Studio). They are compared in the table below. While BlueJ is designed for education, the other two are stripped-down versions of large commerical products. The BlueJ debugger is rather minimal, although still useful. For example, it offers no "run to cursor" or "run to end of method" option.

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.

When compiling one class, the Java compiler will usually need to know where to find the definitions of other classes. You don't have to explicitly tell the compiler how to do this. Instead, you can provide this information when you create your project. Details are given below under the "to set project properties" heading.

Each programming assignment should be treated as a separate project. Note that a project is not the same thing as a package.

implementation BlueJ JBuilder Forte
download address www.bluej.org www.borland.com/products/
downloads/index.html
http://wwws.sun.com/software/sundev/jde/
features/ce-features.html
version evaluated 1.2.0 Personal version 8 Sun ONE Studio 4
approximate size of download (excluding JDK) 1 MB 59-75 MB 40 MB; 125 MB of hard drive space is required, according to the download site
approximate size of downloaded, expanded files 3 MB 125 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 create a *.jpr or *.jpx file under the Open Project choice in that menu. Select Project Manager from the Project menu, and click on the New button. You should also mount a filesystem (see "to set project properties") for the project.
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 or *.jpx file Select Project Manager from the Project menu, select the desired project, and click on the Open button.
to set project properties Libraries may be added by selecting Preferences from the Tools menu, and then selecting the Library tab. Otherwise, make sure that your class definitions are in the folder than contains the project. Select Properties under the Project menu. Set the output path, backup path, and working directory to the folder containing your files. Also (by using the Add button), set the Default and Test source paths to this folder. Don't forget to use the radio buttons to select the folder that you just added. 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 Filesystems tab in the project window, right click on the Filesystems icon, click on Mount and then select the desired folder
to add an existing class Select Add Class from File from the Edit menu Select Add Files/Packages from the Project menu, select the desired tab (Explorer for source code), and then the desired file or package. Select the Project tab from the project window, right click on the project icon, and then select Add Existing
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 New
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 class from the project window and select the class to be removed, and then choose Remove ... from Project from the Project menu Select the Filesystems 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 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 compiled, and then choose Make (or Rebuild) from the Project menu. Select Compile from 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 (or Rebuild Project) from the Project menu. To compile an entire project, select Compile Project or (Build Project) from the Project menu . 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 Using Defaults from the Run menu. If you have created a runtime configuration you may select Run instead. 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 Using Defaults (or Debug) from the Run menu. Note that Step Into and related Run menu choices are unavailable unless an explicit runtime configuration has been defined. 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. For large files you may need to have selected Unlimited Buffering from the Options menu in the terminal window Text in a JBuilder output window may be copied to the Windows clipboard) by right clicking in the window, and selecting Copy All. It then may be pasted to any file Right click in the output window, and select Copy to Clipboard. The text may then be pasted to any file.
creating javadoc files The Project Documentation choice 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 Not possible from this version. Try running bin\javadoc.exe from the folder that contains your Java SDK 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 To create or edit a runtime configuration, select Configurations from the Project menu, and click on the New or Edit button as appropriate. Select at least a type (you can't edit the type of an existing configuration, or create more than one configuration) and a main class (which should be a class in the project). Be aware of the workspace tabs: Editing, GUI Editing, Running, Browsing, and Debugging. Forte project information is in forte-settings\system\Projects
to find a tutorial An online tutorial is available from the Help menu. The file "Building Applications with JBuilder" and other PDF files are available at www.borland.com/techpubs/jbuilder/ Select Contents from the Help menu, and then select Getting Started

* The output window may be cleared in each case by using similar instructions. Also, 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.