Java Instructions

To write your own Java applets you need to download and install two packages from the Sun Website. (Version numbers will increase as time goes on, but those given below were current on 7 Apr 08).

First click on the + in front of Java SE to expand the choices. Then click on the down arrow beside Java SE (JDK) 6. This takes you to the download page where you find JDK 6 Update 5. This is what you want to download. It has the "command-line development tools that are useful for developing applets". While you are here look down to find Java SE 6 Documentation - you need to download it too. The download and installation instructions are easy to follow, but you may find it convenient for command-line work if the folder is in your main directory (I use folders c:\jdk1.3 and c:\jdk1.6).

To work with Java you open the Command Prompt (what used to be DOS). You work from the binary directory (c:\jdk1.6\bin in my case) - this is where "javac" (the Java complier) and "appletviewer" are located. You need to create a folder here to hold your programs (I use a short name like "jj" to cut down on typing). Next you want to put two files into your folder. The first is a small html file that appletviewer uses to access the Java class file. Do a "save as" to put it in your folder. The second is the Java source file. Do another save as, then rename the saved file as a java file "ren jj\fplaw.txt fplaw.java".

Now you are ready to do something using Java. From the Command Prompt issue the command "javac jj\fplaw.java". This will cause the compiler to create "fplaw.class", the file that "fplaw.html" looks for. Next issue the command "appletviewer jj\fplaw.html", and something good should happen.

Next make your own version of the program. Issue the command "edit jj\fplaw.java". Go down to line 111 and change "green" to "magenta". Save the program, then compile it ("javac jj\fplaw.java"). Now when you run appletviewer you see the result of your handiwork. Congratulations!

One obvious question: how does one know that Java recognizes "magenta"? The simple answer: that's what the documentation is for. The next obvious question: and how does one do that? The answer is anything but simple. You have been working in the "bin" folder. Explore and go down to the "docs" folder. Open "docs" then open "api". Double-click on "overview-frame". Click on "java.awt". Click on "Paint" (under Interfaces). Click on "Color" (under Implementing Classes). There you find the colors Java recognizes.

The easiest way to learn how to do something (like using buttons) is to look at the source code of a program that does what you want to do. That is what my Java source code is for.