Page 54 - Introduction to Programming with Java: A Problem Solving Approach
P. 54
20 Chapter 1 Introduction to Computers and Programming
The compilation error message says something like this:
Explanation:
'javac' is not recognized
All three error messages indicate that the computer doesn’t understand thejavac commandbecauseitcan’tfindthejavaccompilerprogram. The error is probably due to the PATH variable being set improperly. Review the JDK installation instructions and reset the PATH variable accordingly.
javac: command not found
bad command or filename
Hello.java: number: text
ThereisasyntaxerrorintheHello.java sourcecode.Thespecified numberprovidestheapproximatelinenumberinHello.java where the error occurs. The specified text provides an explanation for the error. ReviewthecontentsoftheHello.java fileandmakesurethatevery character is correct and uses the proper case (lowercase, uppercase).
Figure 1.9 Compilation errors and explanations Yourcommandpromptwindowshouldnowdisplayyourprogram’soutput—Hello, world!See
Figure 1.10. It shows the command prompt window after completing the steps described above.
Apago PDF Enhancer
Figure 1.10 Compiling and running the Hello World program
1.9 GUI Track: Hello World (Optional)
This section is the first installment of our optional graphical user interface (GUI) track. In each GUI-track section, we provide a short introduction to a GUI concept. For example, in this section, we describe how to display a message in a GUI window. In another GUI track section, we describe how to draw lines and