Java Reference
In-Depth Information
2. Click Compile Java on the Tools menu. If TextPad displays any error
messages, click Welcome.java in the Selector window. Fix the errors and
repeat Step 1.
If TextPad finds no errors while compiling the source code, TextPad
redisplays the source code. The bytecode for the Welcome to My Day
application is saved on the Data Disk.
OTHER WAYS
1. Press CTRL + 1
2. At command
prompt, type javac
Welcome.java
During compilation, the compiler saves the source code again and then adds
a file to the disk called Welcome.class, which is the actual bytecode.
If your TextPad installation does not display the Compile Java command on the
Tools menu, the SDK may have been moved or installed after TextPad. See Appen-
dix C for more information on configuring TextPad. Recall that compiling Java
source code with a VATE program such as TextPad allows you to compile using its
menu system. Alternately, you can compile by opening a command prompt window
and issuing the compile command, javac. If you are compiling at the command
prompt, you may need to change to the directory containing your Data Disk. See
Appendix D for more information on compiling in the command prompt window.
Debugging the Solution
If TextPad displays error messages when you compile the source code, you may
have a system, syntax, semantic, run-time, or other logic error. The process of
fixing errors is called debugging . Debugging can be a time-consuming and
frustrating process, but it is a skill that will improve as you learn to program.
System Errors
If your system displays an error such as unrecognized command or cannot
read file, you may have a system error (Figure 2-28). A system error occurs when
a system command is not set properly, software is installed incorrectly, or the
location of stored files has changed. System errors usually display in the com-
mand prompt window. If you get a system error while compiling using TextPad,
you may not have first installed the Java SDK (see Appendix B). If you get a sys-
tem error compiling the program using the javac command, you may not have
set the required path locations properly (see Appendix D).
command prompt
window
system
error
FIGURE 2-28
 
Search WWH ::




Custom Search