JBuilder X Quick Tour - Part 1

By: Tim Del Chiaro

Abstract: An overview of key features of JBuilder X including editing, debugging, refactoring, and optimizing code

The JBuilder development environment

Features vary by JBuilder edition

The JBuilder integrated development environment (IDE) consists of a window that contains several panes and panels for performing most development functions: editing, visual designing, navigating, browsing, comparing, modeling, building, compiling, debugging, and running. This window is the JBuilder browser.

Note: To expand this window to full width (hiding the project and structure panes), choose View|Maximize Content Pane from JBuilder's main menu.

JBuilder UI

Use the Preferences dialog box (Tools|Preferences) to customize the development environment. You can control such IDE preferences as:

  • Browser settings
  • Recognized file types
  • Build activities
  • Browser Look and Feel
  • Run/Debug console output
  • Audio events
  • Keymapping
  • Editor display, including CodeInsight, TagInsight, and code templates
  • Java Structure
  • Web view (JBuilder Developer and Enterprise)
  • XML, including catalog settings (JBuilder Developer and Enterprise)
  • UML display (JBuilder Enterprise)
  • EJB Designer (JBuilder Enterprise)
  • Mobile Screen (MIDP only) (JBuilder Developer and Enterprise)

Creating a new project

All of the work you do in JBuilder must be done within the context of a project. A JBuilder project is an organizational tool that includes all of your files in your application, the directory structure those files reside in, as well as the paths, settings, and required resources. Each project is administered by a project file, a descriptive file with a .jpx file type.

To create a new project in JBuilder and add a new source file to it, follow these steps:

  1. Choose File|New Project. In the Project wizard, enter the project's name and directory. Click Finish.
  2. Choose File|New Class. In the New Class wizard, enter the class name and click OK.
  3. Choose File|Save All.

In the project pane, you'll see the project file and the source file that now belongs to the project.

Project pane

You can also add a new empty file to the project; choose File|New File, specify the new file name and type, and choose OK.

Using different versions of the JDK

JBuilder supports JDK switching. Right-click the project file in the project pane and choose Properties. Click the JDK ellipsis (…) button on the Paths page, browse to the version of the JDK you want to use, and choose OK.

Using libraries in JBuilder

JBuilder uses libraries to help find everything it needs to run a project, to browse through source, view Javadoc, use the visual designer, apply CodeInsight, and compile code. Libraries are collections of paths that include classes, source files, and documentation files. Libraries are static, not dynamic. Individual library paths are often contained in JAR or ZIP files but can also be contained in directories. Library configurations are saved in .library files.

You can configure existing libraries and add new ones in the Configure Libraries dialog box (Tools|Configure Libraries), as well as add required libraries to your project on the Paths page of the Project Properties dialog box (Project|Project Properties).

Editing your source code

Features vary by JBuilder edition

The editor offers a variety of productivity features, such as brace matching, syntax highlighting, keyboard shortcuts, customizable editor keymappings, and coding shortcuts (CodeInsight, ErrorInsight, Sync Edit, JavadocInsight, code folding and scoping). The editor also offers customizable code templates, searching and identifying capabilities, a tagging tool (TagInsight), and printing. The editor is fully customizable.

To edit your source code, double-click a file in the project pane to open it in the editor. A tab for the open file is displayed at the top of the content pane, making it easy to navigate between open files in a project.


Use the Preferences (Tools|Preferences|Editor) dialog box to customize the editing environment. You can control the following preferences:

  • Editor keymapping
  • Number of backups to keep
  • Ability to show current scope
  • Code folding
  • Indent and paste options
  • Line numbering and smart key options
  • Save and search options
  • Brace match and error display options
  • Margin and font settings
  • Editor color scheme for Java, HTML/XML, JSP, and other elements
  • CodeInsight display and popups (MemberInsight, ParameterInsight, JavadocInsight)
  • TagInsight display and popups
  • Code templates for Java, HTML, and Common templates
  • Java structure display

Designing your user interface

To design a window, double-click a designable file in the project pane, such as WelcomeFrame.java. Then click the Design tab at the bottom of JBuilder's IDE. To add a component to your application, click a component on the component palette, then drop it under its parent in the component tree or where you want your component to appear on the design surface. Set the control's properties and events by editing them in the Inspector.

UI Designer

Creating menus

To add a menu to your application, click the Design tab, then select a JMenuBar Menu bar or JPopupMenu component Pop-up Menu from the Swing Containers page of the component palette. Drop the component on the component tree. Then double-click the menu component in the component tree to start the menu designer so you can modify the menus and individual menu items.

Building, compiling, and running your project

Building your project is as simple as choosing Project|Make Project. The JBuilder build system, based on Ant, builds all buildable nodes. You can also right-click a buildable node or nodes in the project pane and choose Make to only build selected nodes. During the make phase, various processes may occur depending upon what node is selected: preparing non-Java files for compiling, compiling of Java source files, generation of archive files, and so on. Messages from the build system are displayed in the message pane.

Building, compiling, and running your project

To run your project, choose Run|Run Project or right-click a file in the project pane and choose Run.

To set the main class and VM parameters for your project, go to the Run page of the Project Properties dialog box (Project|Project Properties).

Additional build features

JBuilder provides additional build features, which vary by JBuilder edition.

These are features of all JBuilder editions
  • Build projects with Ant.
  • Add build files to your project with the Ant wizard (Wizards|Ant).
  • Add additional targets and tasks to the Project menu for building projects and project groups.
  • Customize and extend the build system with the OpenTool Builder class.
  • Automatically discover source packages.
These are features of JBuilder Developer and Enterprise
  • Switch Java compilers.
  • Filter packages and exclude them from the build process.
  • Export a JBuilder project to an Ant build file with the Export To Ant wizard (Wizards|Export To Ant).
  • Build project groups.
  • Create external build tasks to execute during the build process.
  • Selectively copy resources.
This is a feature of JBuilder Enterprise
  • Generate Java from SQLJ translators.

Advanced build features

Visualizing code with UML

This is a feature of JBuilder Enterprise

JBuilder uses UML diagrams for visualizing code and browsing classes and packages. UML diagrams can help you quickly grasp the structure of unknown code, recognize areas of complexity, and increase your productivity by resolving problems more rapidly.

Two UML diagrams are available in JBuilder:

  • Limited package dependency diagrams
  • Combined class diagrams

To view a UML diagram, compile the project and double-click a source file or package in the project pane. Then choose the UML tab at the bottom of the browser.

Class diagram

Refactoring code symbols

This is a feature of JBuilder Developer and Enterprise

JBuilder provides many types of refactorings:

  • Optimize Imports
  • Rename Refactoring
  • Move Refactoring
  • Change Parameters
  • Extract Method
  • Introduce Variable
  • Introduce Field
  • Surround With Try/Catch
  • Pull Up Method and Field
  • Push Down Method and Field
  • Extract Interface
  • Introduce Superclass

Refactorings are available from the Refactor menu, the editor context menu, the structure pane context menu, and a UML diagram context menu. To refactor from the editor, select a symbol or expression, and choose a refactoring command from the Refactor menu. Some refactorings display a dialog box and a Refactoring tab in the message pane; other refactorings occur automatically. The Refactoring tab displays a preview of the refactoring.

Refactoring tab

Before refactoring, JBuilder provides several ways to learn about a symbol. You can find its definition using the Refactor|Find Definition command. You can also find all references and all local refernces for a symbol using the Refactor|Find References and refactor|Find Local References commands.

Debugging your program

Debugging features vary by JBuilder edition

You can debug both local and distributed applications, including servlets, JSPs, applets, EJBs, and unit tests. To debug files in your project, choose Run|Debug Project. Your program may be compiled. You can set runtime configuration options for the debugger. When debugging, you can view control your program's execution, exmine data values and step through code. The debugger UI, consisting of the debugger views, the toolbar, the session tab and the status bar is displayed in the message pane.

Debugger user interface

Unit testing

Unit testing is a feature of all editions of JBuilder. Cactus integration and Fixture wizards are features of JBuilder Enterprise.

JBuilder integrates JUnit's unit testing framework into its environment. This means that you can create and run JUnit tests within the JBuilder IDE. JBuilder also supports Cactus, which provides unit testing of server-side Java code. In addition to the powerful unit testing features of JUnit and Cactus, JBuilder adds wizards for creating test cases, test suites, and test fixtures, and a test runner called JBTestRunner which combines both text and GUI elements in its output and integrates seamlessly into the JBuilder IDE.

All editions of JBuilder include the following unit testing features:

  • Test Case wizard
  • Test Suite wizard
  • Test running
  • JBTestRunner
  • JUnit TextUI support
  • JUnit SwingUI support
  • Test debugging

JBuilder Enterprise adds these features:

  • EJB Test Client wizard
  • Cactus Setup wizard
  • JDBC Fixture
  • JNDI Fixture
  • Comparison Fixture wizard
  • Custom Fixture wizard

Test runner

Optimizing your program

Optimizeit integration is a feature of JBuilder Enterprise

The integration of Optimizeit Suite in JBuilder makes it easy to optimize both local and distributed applications, including servlets, JSPs, applets, EJBs, and unit tests. To test files in your project, choose Run|Optimize Project. Your program may be compiled. When using Optimizeit, you can pinpoint memory problems, thread contentions, and dead code. The Optimizeit user interface, consisting of the tool selection, the toolbar, the view tabs and the status bar, is displayed in the message pane.

Optimizeit user interface

Download JBuilder and get started now!

Click here to download a free copy of JBuilder X. The JBuilder Enterprise Trial/Foundation download lets you try the complete JBuilder X Enterprise edition for 30 days. Then purchase a license to continue using the Enterprise edition or downgrade to the free, non-expiring Foundation edition.

Server Response from: ETNASC03