Java Reference
In-Depth Information
Consider the binary number 1111101010001010101 2 . Now:
1111101010001010101 2 ¼ 111 1101 0100 0101 0101 2
¼ 0111 1101 0100 0101 0101 2 , add one zero to the left
¼ 7D455 16 .
Hence, 1111101010001010101 2 ¼ 7D455 16 .
Next, to convert a hexadecimal number into an equivalent binary number, write the
four-digit binary representation of each hexadecimal digit into that number. For example:
A7F32 16 ¼ 1010 0111 1111 0011 0010 2
¼ 10100111111100110010 2 .
Thus, A7F32 16 ¼ 10100111111100110010 2 .
Executing Java Programs Using the
Command-Line Statements
When you install JDK 7.0 in the Windows 7.0 environment, the system creates two main
subdirectories: Java\jdk1.7.0 and Java\jre1.7.0 . These two subdirectories are, typi-
cally, created within the directory c:\Program Files\Java . However, these subdirectories
might also be created in the directory c: as c:\jdk1.7.0 and c:\jre1.7.0 .(Checkyour
systems documentation.) The files necessary to compile and execute Java programs are placed
within these subdirectories, along with other files. For example, the file javac.exe to
compile a Java program and the file java.exe to execute a Java application program are
placed within the subdirectory jdk1.7.0\bin or jdk1.7.0\fastdebug\bin .Youcan
set (or alter) the Windows system environment variable Path to add the path where the
files javac.exe and java.exe are located. This will allow you to conveniently compile a
Java program from within any subdirectory. In the Windows 7.0 Professional environment,
you can also set the environment variable CLASSPATH so that when you execute a Java
program, the system can find the compiled codeoftheprogram.Next,wedescribehowtoset
up the Path .
Setting the Path in Windows 7.0 (Professional)
To set the Path so that you can compile a Java program from within any subdirectory,
perform the following steps.
1. Click the Start button (lower-left corner of the window.)
2.
Select Control Panel . A window similar to the window shown in Figure D-3
appears.
 
Search WWH ::




Custom Search