If your computer uses Windows XP or 2000 or 98 and Java is not already installed
on your computer, then you can download and install a copy for free.
Go to
http://java.sun.com/j2se
On the right column of the web page, you will see links for downloading
and installing Java. You may use either of J2SE 5.0 or
J2SE 1.4.2. Further, when you go to the appropriate page, you may
select either basic Java (``JDK'') or you may select Java plus the
NetBeans IDE. (Java and NetBeans are large, so if you are tight on disk
storage, maybe you don't want NetBeans.)
The download step is routine, and you should let the installation
program install Java at the folder, say,
C:\j2sdk1.4.2_04.
Once the installation finishes, you are ready to try Java.
Open a new command window, and type first,
set path=C:\j2sdk1.4.2_04\bin
This resets the command window so that it knows that it should
search the above folder to find the
Java software. Next, type
javac. You should see a long message like this:
>javac
Usage: javac
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
etc...
If you see instead,
'javac' is not recognized as an internal or external command,
operable program or batch file.
Then recheck the folder where Java was installed on your computer and try
again.
Now you are ready to use javac and java to compile
and execute programs from the command window.
Just remember --- each time you open a command window, type first,
set path=C:\j2sdk1.4.2_04\bin
Permanently resetting the PATH variable
It is a bit annoying to type set path=C:\j2sdk1.4.2_04\bin every time
you open a command window, and there is a clever repair --- you can reset
permanently
the value of Windows's
PATH variable so that Windows knows once and for all
that Java is available at C:\j2sdk1.4.2_04.
Here is what you must do on Windows XP to reset the Path variable:
press Start
select Control Panel
On the Control Panel window, in the left column, press Switch to
classic view (If you don't see this text, go to the next step below.)
Double click on the icon for System
In the System window, click on Advanced
Click on the button Environment Variables
In the new window, scroll until you see the variable, Path;
click on it
Press Edit
Carefully use the right arrow button to move to the end of the
long sequence of folder names. At the very end, without including
any extra blanks, type this:
;C:\j2sdk1.4.2_04\bin
Press OK twice.
These steps make Java known to Windows XP.
Now, check if you have done the job correctly: Open a new command
window, type path, and you will see the text you edited
for the Path variable. You should see
;C:\j2sdk1.4.2_04\bin at the end.
Next, type javac. You should see the message displayed earlier.