|
We will be using version 1.2 of the Java language for this course. The CD-ROM that comes with your textbook contains three different development environments to use for writing Java 1.2 programs. They are 1) Sun's JDK 1.2.1, which is the basic, bare bones, Java development environment, 2) Borland's JBuilder 3, which is a large, sophisticated Integrated Development Environment (IDE), 3) NetBeans DeveloperX2 2.1, another IDE. There are some other Java development environments available over the Internet that have advantages over all three of the environments that come with the book. On this page I will give you some information about all of these options.
Sun's JDK 1.2 is a command line environment. That means that it can be hard to use. But what is more important is that it is the foundation for several of the other programming environments that you can use, so you need to install the Sun JDK. Using the version that is on the CD-ROM (which is not the most recent version) will save you from downloading the JDK from the Internet.
Borland's JBuilder is a large program. (Borland recommends a minimum of 128MB of RAM to run the latest version of JBuilder!) It is meant for professional programers. In my opinion, a lot of what is in this IDE can just get in the way of writing small programs like the ones you will work with in this course. It is important to learn how to use large IDE's like JBuilder, but you may, like me, find that working with a much smaller development environment is better for what we will be doing in this course.
NetBeans Developer is harder to use than JBuilder. If you want to use a large IDE, use JBuilder. (NetBeans Developer is an example of an IDE that needs Sun's JDK pre installed.)
Two small IDE's that I think are very good for what we will be doing in this course are KAWA by TEK-TOOLS, and JPad Pro by Modelworks. I will explain more about them later in class. Their only real disadvantage is that they are shareware, not freeware. (Both of these IDE's need the Sun JDK pre installed.)
For the purpose of getting started as easily and quickly as possible, I will now explain how to install what I think is the simplest and most elegant "IDE" for writing small Java programs. Basically, what we will do is install the Sun JDK and then install a very good text editor as a "shell" or "wrapper" for using the JDK. Below are the steps to follow to install this combination of programs.
|
- Step 1:
- If you do not have the program WinZip already installed on your home computer, then you should install it first. Download the Windows 95/98/NT version from the WinZip Download Page; follow the instructions on that page to install WinZip.
- Step 2:
- Install Sun's JDK 1.2. You should probably do this using the version (JDK 1.2.1) that is on the book's CD-ROM. (The JDK is quite large, so it is difficult to download from the Internet using a modem.) Insert the CD into your drive and follow the directions. (If you don't have autorun turned on, double click on the file Welcome.html on the CD.) Don't change the default location of where the JDK will be installed, and be sure to set the PATH variable as explained in the instructions on the CD. Reboot your computer after you have set the PATH variable.
If you want to install the most recent version of Sun's JDK 1.2, then use the link at the end of this paragraph. The JDK 1.2 is over 20 MB, so expect the download to take several hours using a modem. To install the JDK either follow the instructions on Sun's web pages or follow the instructions on the book's CD-ROM (the installation instructions haven't changed).
Sun's Java Development Kit 1.2.x
- Step 2.5 (Optional):
- The JDK does not come with any documentation. If you want the HTML version of the documentation, you need to install that separately. But the HTML version of the documentation is large (about 100MB installed) and not easy to use. Later in this page I will show you a better version of the documentation to install. But if you want the HTML version, read on.
The HTML version of the documentation comes in a zip file (that's why you need WinZip). Either use the version of the documentation that is on the CD-ROM or download the most recent version from the link at the end of this paragraph. Unzip the documentation to your
C:\ drive, not to the C:\jdk1.2.x\ directory; the zip file will automatically unzip itself into the proper subdirectory of C:\jdk1.2.x\ . (After you have unzipped the documentation, check that there is a docs subdirectory of C:\jdk1.2.x\ . That's where the documentation should now be.)
Java 2 SDK Documentation
- Step 3:
- If you want to you can test your JDK installation. Use the Start Menu to start up a "MS-DOS Prompt" window. At the DOS prompt, enter the command javac; if you don't get a usage message back from the Java compiler, then you probably forgot to set your PATH variable. Now use your favorite text editor to create the Welcome1.java program on page 36 of our textbook. Then follow the directions on page 16 of the book to compile and run the Welcome1 program. Make sure you can do this before going on to the next step.
- Step 4:
- Download the TextPad Version 4.1 text editor. TextPad is shareware; you can download and use it for free for a trial period, but then you are supposed to pay a shareware fee if you plan to continue using it. Use the following link to download the installation file (which is just over 2.3MB in size).
ftp://download.textpad.com/pub/textpad4.1/txpeng41.exe
- Step 5:
- Install TextPad by double clicking on the installer that you just downloaded.
- Step 6:
- Run TextPad by finding it in your Start Menu. Click on the Tools menu at the top of the TextPad window; you should see three commands for using Java at the bottom of the list. If you don't see the commands, try going to TextPad's Configure menu and click on Configure -> Preferences..., then click on "Tools" (not the little + sign next to "Tools"), then click on Add and then select "JDK Commands" from the drop down menu, finally click on OK. (For more information on using the JDK with TextPad, and on TextPad's tools, click on the Help -> Help Topics menu item and use the Index tab to search for JDK).
- Step 7:
- Now it is time to test TextPad. Use TextPad to open your file Welcome1.java. Use the Tools -> Compile Java menu item to have TextPad run the Java compiler. Now use the Tools -> Run Java Application menu item to have TextPad run your program. Now deliberately put a mistake into your Java program by deleting a semi colon. Compile the program to see what happens. Double click on the line number in the compiler's error message to have TextPad jump to the offending line. Try using the keyboard shortcuts to compile and run your program.
- Step 8 (Optional):
- When learning Java, it is important to learn how to use Java's documentation. So now we will install an easy to use version of the Java documentation. Open your
C:\jdk1.2.x\ directory (x is 1 or 2 depending on which version you installed) and create a subdirectory called docs-win . Download the Windows Help File version of the Java 2 documentation using the link at the end of this paragraph. (That link directs you to a page in France where the person who maintains these help files resides.) After you have downloaded the help file, use WinZip to unzip it into the C:\jdk1.2.x\docs-win\ directory that you just created.
Java Documentation in Microsoft Windows Help Format
- Step 9 (Optional):
- Now we need to create a tool in TextPad to use the help file we just installed. Start TextPad and go to TextPad's Configure menu and click on Configure -> Preferences... menu item, then click on "Tools" (not the little + sign next to "Tools"), then click on Add and then select "Online Help File..." from the drop down menu. Use the dialogue box to navigate to the
C:\jdk1.2.x\docs-win\ directory, select the file Jdk122.hlp , click the "Open" button, click the "OK" button. Now look at the bottom of your list of TextPad tools, there should be one called Jdk122. Open a Java source file with TextPad, select the word class, and then click on the Jdk122 tool. This should bring up a help window.
- Additional Steps to Come:
- I will add some more steps that will show you how to add more Java online documentation and how to install the older, but still very important, JDK 1.1.8 to your development environment. In addition, I will show you how to add a nice C compiler, with Win32 API documentation, to your growing tool chest.
TextPad is a very powerful text editor. It has a lot of tools that make working with Java and HTML files much easier. Editors like Notepad or DOS's Edit really pale in comparison to an editor like TextPad.
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?
|
|
|
|