Java2 Software Development Kit Windows installation instructions

 

©2000-2007 by Wayne Pollock, Tampa Florida USA.  All Rights Reserved.


To setup the Java SE development kit (also known as the JDK) you can follow these steps on Windows:   Sun's install directions for JDK.

  1. To install the JDK you must go to the Java download page, click the link for the newest version of Java SE showing, download the JDK (and not the JRE).  You must scroll down until you see the link to Download JDK.  There are other downloadable packages shown, but you don't need any of them, expcept possibly the documentation.

    After you agree to the lisense agreement you come to the final download page.  Download the file for Windows, the link "Windows Offline Installation, Multi-language".  This file is approximately 50 MB.  (If a newer edition becomes available, the name and size may be different.)

    After downloading, execute this setup program to install the JDK.  This will create a C:\Program Files\Java\JDKversion directory by default.  If you rename this directory from this default, you will have extra work to install the documentation!  Nonetheless, it will simplify advanced Java setups later if you install to a directory with a short, simple name.  Personally I use C:\Java as the install directory.

    Running the installer is fairly easy.  Accept the license terms.  Next select what to install.  I suggest installing everything except the source code.  (This takes over 300 MB of disk space once installed.)  For each item, select where to install it; I suggest putting the JDK in C:\Java.  Note that as part of the JDK, a version of the JRE is installed.  This JRE is used only when compiling code with the JDK tools, such as javac.

    Next the JRE (used to run programs and applets) installer will run.  I suggest installing everything, and letting it control all browsers for applets.  The default location for to install the JRE is C:\Program Files\Java\jdkversion\, and that is fine.  However you will need to note this location down for later.  Onces installed the JRE takes about 110 MB of space.  So make sure you have about 370 MB disk space free before installing.  After the install you can delete the 53 MB installer program.

    Note:  The JRE is controled by the Java control panel.  After the install is completed, you might want to run this control panel and change some of the default settings.

  2. Next, go back to the Java download page again, and scroll down until you see the section for the "Java SE" documentation.  Install the JDK documentation if you wish, it is about 50 megabytes to download (but over 265 megabytes once installed).  Or you can browse the documentation online.  (Bookmark—or add to favorites—this link for easy reference.)  The documentation download is a .zip file.  You need to use Winzip (or the Window built-in version) to extract the documentation.

    You can install the documentation by extracting all files at C:\Java (or where ever you installed the JDK at).  This should create a new directory named C:\Java\docs.  When you are done, you should set a bookmark (or favorite) to point to the documentation (the file C:\Java\docs\index.html) from your browser of choice.  I would also create a second bookmark to jump right to the API.

  3. At this point the JDK is installed and ready to go, but it is inconvienent to use under Windows.  You should create a directory to hold your java programs, say a folder named "javawork" or some such name.  Also, to run the JDK programs requires typing in long names for the executables, such as "C:\Java\bin\javac SomeProgram.java".  To be able to use short command names ("javac SomeProgram.java") you must update the system setting known as the PATH environment variable.  Exactly how this is done depends on your version of Windows.  If you wish you can follow the Sun's install directions for the JDK to set the PATH environment variable (step 4) so you can use short command names.  For the recommended setup, for the current version at the time of this writting, you should add the following to the front of the PATH variable:     C:\Program Files\Java\jre1.6.0\bin;C:\Java\bin;

    Creating a short-cut that, when double-clicked, opens a command line window right in your working directory (say "C:\JavaWork") would be most convienent.  For older Windows systems the shourt-cut can also set PATH (and possibly CLASSPATH, which non-Sun java tools may use in an incompatible way).  The directions below explain how to do this for Windows95/98/ME, and can be adapted to modern Windows.

    A short-cut on the desktop (and in the "Start" menu and quick-launch bar too, if you want) should be created which will setup the environment for you.  This setup should include setting the envronment variables PATH (and optionally JAVA_HOME, which may be used in more advanded setups), as well as setting a default working directory and setting (or unsetting) CLASSPATH if necessary.  Figuring out how to do this normally requires some understanding of Windows and DOS, but here are some instructions you can follow for Windows 98/ME:
    Warining:  Setting CLASSPATH in AUTOEXEC.BAT is a bad idea, as it may mess up Netscape, JBuilder, and possibly other Java related programs.  (The JDK installation instructions say you don't need to set CLASSPATH at all, but this is only partially true.  If you develop you own packages, or install extra packages of Java classes, you may need to set CLASSPATH.)
  4. Create a DOS .BAT file to setup the environment for you.  (Not needed for Windows 2000 or newer!)  The .BAT file should also install DOSKEY, which allows you to repeat previous commands by use of the up-arrow key.  (On some computers DOSKEY is already installed in the AUTOEXEC.BAT file, which is a good idea.  If so, don't try to also install it in this .BAT file.)  The file I created here for HCC is called SetUpJav.bat.  The contents of the file should be:
    @ECHO OFF
    SET JAVA_HOME=C:\Java
    SET CLASSPATH=.
    SET PATH=%JAVA_HOME%\BIN;%PATH%
    DOSKEY
    

    (This is a little different than the version at HCC. ) To create this file, copy the above lines to Notepad and then save the file with the correct name.  (Make sure Notepad doesn't add a ".txt" extension to your file.  If so you will need to rename the file by right-clicking on it and choosing rename.)

    This SetupJav.bat file can be put anywhere at all.  I recommend putting it in C:\Java\SetUpJav.bat.  (You should use the actual install directory if different from C:\JDK.)

  5. The last step is to create a shortcut.  The shortcut properties say what .BAT file to run and what the current working directory should be.  The .BAT file should be the full pathname of the SetUpJav.bat file created in the previous step.  (If you followed my recommendation, that pathname is C:\Java\SetUpJav.bat.)  At HCC, the shortcut is called Java

    The Working directory should be set to the place where you keep your .java and .class files.  At HCC, I have set this directory to C:\temp, but at home you may wish to use a different directory.  I personally use the directory C:\JavaPgms at home.  (Note the directory you name must be created first if it doesn't already exist!)

    The easist way to create the shortcut is to copy the shortcut for MS-DOS Prompt (or "cmd" on more modern versions of Windows) and rename the copy.  To locate this shortcut, right-click on the Start button and choose "Open".  Now double-click on "Programs" and you should see the shortcut.  Click on it once to highlight it, then choose "Copy" from the "Edit" menu, then choose "Paste".  Now rename the copy to something like "Java". 

    When you have finished creating the shortcut, you need to set its properties.  Right-click on the new shortcut and choose "Properties" from the menu that appears.  Click on the "Program" tab to set the properties: 

    1. Change the first line, which is the title of the window that will apprear when this shortcut is opened.  Something like "Java Work" or "JDK" or some such title.
    2. You can change the icon that appears too, by clicking on the "Change Icon" button and choosing one you like from the list.
    3. Next, type the the path for the working directory you would like, under the heading "Working:".  I recommend C:\Temp or some other directory created for this purpose.
    4. Finally, enter the complete pathname to the .BAT file created earlier, under the heading "Batch file:".
    5. Under the "Screen" Tab there is a setting for how many line to make the console window.  The default is 25 lines.  If you want you can change this to 43 or even 50 lines, which can be handly when viewing error messages or using the Edit editor.  Just click the "Screen" tab, then select "50" from the drop-down list.
    6. Click OK, and setup is complete!

    The shortcut created in the previous step can be copied and placed onto the desktop if you prefer not to use the Start menu.

 


Trouble-shooting Tips