|
- Step 1:
- If you do not have the program WinZip already installed on your home computer, then you need to install it first. Download the Windows 95 version from the WinZip Download Page; follow the instructions on that page to install WinZip.
- Step 2:
- Download the Java compiler from Sun. The complete name for this compiler package is the Java Developer's Kit (JDK) 1.0.2. Everything you need is in one file that is about 4MB in size. Sun provides a page of installation instructions, but I suggest that you follow the instructions on this page. Download the distribution file to your C:\ directory by clicking on the following URL; have your browser save this file in the C:\ directory:
ftp://ftp.javasoft.com/pub/jdk1.0.2/JDK-1_0_2-win32-x86.exe
- Step 3:
- Now that you have the distribution file JDK-1_0_2-win32-x86.exe in your C:\ directory, find it in a directory window and double click on it. It will automatically open a DOS window and create a directory C:\java into which it will place all the Java files. After it has done this, you can delete this distribution file to save space if you wish.
- Step 4:
- You need to create a subdirectory cs125 of the directory C:\java created in the last step. To create C:\java\cs125, open C:\java in a directory window, click on the "File" Menu of this directory window, and choose "New" -> "Folder". Call the new folder cs125.
- Step 5:
- Now you need to download a file created by the author of our textbook. Download the file by clicking on the following URL; have your browser save the file in the directory C:\java\cs125 that was created in Step 4.
http://www.horstmann.com/ccj/ccjfiles.zip
- Step 6:
- You need to "unzip" the compressed file ccjfiles.zip that you downloaded in the last step. This is where you need WinZip. Right click on the file C:\java\cs125\ccjfiles.zip. If WinZip is installed properly, a menu will pop up containing the choice "Extract to..."; click on this choice. You need to "Extract To" the directory C:\java\cs125. Either type C:\java\cs125 directly into the "Extract To" box, or use the directory tree in the center of the window to choose the directory C:\java\cs125. Then click on the "Extract" button. After you have unzipped ccjfiles.zip, you can delete it to save space, if you wish.
- Step 7:
- Now you need to download a DOS batch file, javaset.bat. Place this file in your C:\ directory. When you click on the above link, if your browser asks where to save the file, save it in C:\. If your browser displays the batch file, then click on the browser's "File" Menu, click on the "Save As" command, and save the batch file in C:\.
- Step 8:
- Now you are ready to try out Java. But first read Section 1.8, pages 21--22, and Section 1.10, pages 28--30, from the Java textbook. To try and compile a Java program, use the Start Menu to start up a "MS-DOS Prompt" window. At the DOS prompt, enter the DOS command "cd C:\java\cs125\ch1" (without the quotes) which will move you to the directory C:\java\cs125\ch1. Now enter the command "c:\javaset" (which should respond with a line of output beginning with the word PATH). Now enter the command "javac" (you should get a usage message back from the java compiler). Now enter "javac Hello.java" (you should NOT get any output back). Now enter "java Hello" (you should get the output "Hello, World!").
- Step 9:
- Read Section 1.11, pages 26--28 (including the Common Error 1.2 on page 28). To familiarize yourself with the Java compilation process, try out the changes to the Hello.java program mentioned on pages 26 and 28.
- Step 10:
- This last step is optional. If you would like to, you can download a good text editor to use instead of Notepad for editing your Java source files. A good freeware editor is the Programmer's File Editor (PFE). Since PFE is freeware, you can use it for as long as you wish, without having to pay. Use the following link to download the distribution zip file.
http://www.lancs.ac.uk/people/cpaap/pfe/pfe0702i.zip
Once you have the distribution zip file, create a directory C:\pfe and extract the zip file into it. You need to create your own program group for the start menu, or better yet, put a shortcut to PFE on your desktop and/or in the folder "C:\Windows\Send To".
A very good text editor is TextPad. TextPad is shareware; you can download and use it for free for a trial period, but then you are supposed to pay a modest shareware fee if you plan to continue using it. Use the following link to download an installation file.
ftp://ftp.textpad.com/pub/tpe32321.exe
When you are editing your Java source files with any editor, remember to save your work frequently (at least every 15 minutes), otherwise it may be Abort, Retry, Ignore?
|
|