These pages are aimed at the beginning programmer with no experience
in Java whatsoever. We'll start with instructions that help with
getting and installing Java tools, explaining the program-development
process, introducing development environments (optional), and
then a brief introduction to the Java language.
Step 1: Get the Java tools you need to your PC:
- What are these tools? You will write your Java code in an
editor like WordPad or NotePad (or, as we recommend, some
specialized Java editing tool such as JGrasp - see below).
The Java code (program) is a plain text file, like HelloWorld.java
that ends with the ".java" file suffix.
Then you will need to compile your Java program, following
which you can run or execute your Java program (if
compilation did not result in errors).
- To download the tools (which are free), you can follow one or
both of the following:
- Things to keep in mind for downloading:
- The term downloading here means "going to a
website, getting a large file and saving it to your local disk".
- Typically, you get all the Java tools together in one huge
file, usually an EXE file. When you save and then double-click
on your saved EXE file, you will be walked through a setup
(like "setting up" any other software on Windows).
- You will need to watch out for which file you
download, depending on your system. Most likely you will be
using Windows 98, Windows 2000 or Windows XP. For this purpose,
any of the Windows "bundles" will do.
- What's a bundle? What's the difference between JDK1.4 and
J2SE v1.4.2? Aha! You've just run into Java's naming confusion.
Here's what you need to know:
- Java used to use names like JDK1.1, JDK1.2 etc for their
toolkits. Now they use both JDK as well as new-fangled names
like J2SE. For example, the current version as of July 2003
is J2SE v1.4.2 (the "v1.4.2" is a version number). Sometimes
"SDK" is used in place of "JDK", to add to the confusion.
- Version numbers have three digits, of which only the first
two matter for our purposes.
- For basic Java, any version higher than 1.1 will do.
Do NOT download JDK 1.0 or JDK 1.1.
- When you click to download, you will have to walk through
a number of "questions" and click "accept" on a licensing agreement.
Don't let either of these bother you - they're fairly standard,
everybody fills them out.
- You have to complete the download first before you can
starting installing.
- Note: many Java books provide CD's with the JDK (or J2SE)
that you can simply insert to install.
Step 2: Understand the process of creating a (Java) program:
- First, you edit the source file. For example,
this file is a simple text file
containing the source for a Java program, readable
in an editor like WordPad or NotePad. To create such a program
from scratch, you can get into NotePad and type it out.
- Then, you save the source file to your disk (using
"save" in WordPad).
- The next step is to compile the program. This is a
little tricky the first time if you are NOT using a development
environment (such as JGrasp). To do this, you will have to
bring up a Command Prompt window (DOS prompt) and compile.
- If the program was correctly typed and has no syntax errors,
the compilation should work. If it doesn't work, the compilation
procedure will show some errors, spewing stuff out to the screen.
- Assuming the compilation worked, you can execute or
run the program. Again, if you are not using a dev environment,
you need to do this from the command prompt.
- To use the command prompt method, see these instructions.
You ought to try using the command prompt at least a couple of times
until you're comfortable with the process.
- We recommend using a development environment
eventually, or even immediately if you don't like command-prompts.
A development environment is simply a software program that
has it all: it lets you edit programs, it
lets you compile and even run program, all from within the environment.
See Step 3 below.
- Development environments need to be downloaded (links provided below).
Step 3: Try out a few options for editing programs:
Step 4: Learn Java with applets: (a work in progress)