|
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 5 of 6
| Tip |
|---|
| For projects consisting of several source files, using Compile Project is time consuming because that menu item causes all source files to compile. When only a single source file has changed, and when that file appears in the Editor window, you save time by selecting Compile File from the Build menu, which recompiles only the file in the Editor window. |
After compiling the project, you are ready to run Lines. Select Execute Project from the Build menu (or press the F5 function key). In response, JCreator launches an external tool to run the applet. Figure 3 displays the results.
Figure 3. Appletviewer displays Lines' output of randomly colored lines in random positions. Click on thumbnail to view full-size image.
Figure 3 also displays init() called on the bottom workspace window's Output tab. That output originates from a System.out.println ("init()"); method call in the applet's public void init() method (which does not appear in Listing 1 but originally was part of Lines.java). To have JCreator capture the applet's standard output to the Output tab, follow the same steps as shown earlier for capturing
the compiler's standard output to the Build tab. However, make sure Select Tool Type displays Run Applet instead of Compiler.
| Caution |
|---|
| Because Execute Project does not cause an uncompiled project to compile, you see error messages if a project's class files do not exist. You must therefore compile a project before executing it. |
Consider an application project with multiple source files that each declare a class with a public static void main(String [] args) method. How do you tell JCreator to execute a specific main(String [] args) method? Display the appropriate main(String [] args) method's source file in the Editor window, compile that file, and then select Execute File from the Build menu. As with Compile
File, Execute File only appears when the Editor window displays.
Because Lines has no bugs, debugging is not an issue. However, you will sometimes encounter a malfunctioning project, where you must locate
and fix its bugs. You can locate those bugs either through System.out.println() method calls or the SDK's jdb.exe debugger program that integrates with JCreator.
System.out.println() method calls are useful for displaying variable values and telling you that certain code paths execute. Beyond that, however,
the usefulness of those calls fades, and you need to consider the jdb.exe debugger.
After compiling a project, ensure the project's start file appears in the Editor window. Either select Start Debugger from
the Build menu or type Ctrl+F5; JCreator starts jdb.exe. You then use additional debugging commands, such as Step (F10) and Continue (Ctrl+F10), from the Build menu (or Dump (F8),
Threads, Memory, Classes, and Toggle BreakPoint (F9), from Build's Debugger submenu) to debug your code. jdb.exe sends its output to the Debug tab in the bottommost workspace window (provided that tool's Capture Output checkbox is checked).