Java Reference
In-Depth Information
figure 3-1  
5.
Note the drive that is shown when the command window opens; this is your current directory. You
can move your new Java file to this location or change your current directory to the location where
you saved your file. To change the current directory, type cd followed by the location path (the
example shown here will not be identical to your own path), and then press Enter:
cd C:\Users\n12063\MyFiles
6.
You can verify that your file is in the current directory by typing dir and pressing Enter. This will
show you the contents of the current directory. If you can see MyFirstApplication.java in the
list, you're ready to proceed.
7.
Next, you want to instruct your Java compiler to compile your program. To do so, you need to
point to the compiler's location and then instruct it to compile your Java file. Your Java compiler
is called javac and is located in the bin folder of your JDK; it depends on where you first installed
the JDK. Navigate to the right folder and find the location path, then enter it exactly in the com-
mand prompt to tell Windows where to find your Java compiler. Start with a quotation mark,
enter the location of the bin folder, then type \javac and another quotation mark. Finally, add a
space and the name of your java file. Press Enter. It should look something like this:
"C:\Program Files\Java\jdk1.8.0_25\bin\javac" MyFirstApplication.java
8.
You can type dir again to see if the newly compiled MyFirstApplication.class file is there. If you
see both MyFirstApplication.java and MyFirstApplication.class , you're ready to continue.
Search WWH ::




Custom Search